+25
−47
mechanics/compose/src/com/android/mechanics/compose/modifier/VerticalTactileSurfaceRevealModifier.kt
+26
−47
Loading
Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more
The core logic for managing a `MotionValue` within a Compose `Modifier .Node` has been extracted into a new, reusable `MotionValueNode`. This node encapsulates the lifecycle management, coroutine scope, and observation logic for a `MotionValue`. Modifiers like `VerticalFadeContentRevealModifier` and `VerticalTactileSurfaceRevealModifier` have been updated to delegate to this new `MotionValueNode`, which simplifies their implementation by removing boilerplate code related to creating, running, and cleaning up the `MotionValue` instance. Add `MotionValue.isOutputFixed` for Optimization This boolean indicates whether the output value is guaranteed not to change, even if the input value changes. This occurs when the animation is stable and the input falls within a segment that maps to a constant value (e.g., `Mapping.Fixed`). The primary benefit of this is to optimize layout performance. The `ApproachLayoutModifierNode` implementations now use `!isOutputFixed` to determine if a measurement approach is in progress. This is more precise than the previous logic, preventing unnecessary re-measurements when the output is static, thus improving efficiency. Test: atest MotionValueTest Bug: 419520966 Flag: com.android.systemui.scene_container Change-Id: I356528db2bab7b4f7a9960e9426269844ed3a052