Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c01d0372 authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Use separate SemanticKey for keys with null values" into main

parents 35346556 6fbdc9cf
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -59,6 +59,13 @@ class MagneticDividerUtils {
         */
        @JvmStatic val SNAP_POSITION_KEY = SemanticKey<Int?>()

        /**
         * Key used for identity regions which don't have drop zones associated with them.
         * Need to keep this key separate for the SemanticKeys we create with null values as it
         * seems like this overwrites the semantics created with real snapTarget values
         */
        @JvmStatic private val SNAP_POSITION_KEY_IDENTITY = SemanticKey<Int?>()

        /**
         * Create a MotionSpec that has "snap zones" for each of the SnapTargets provided.
         */
@@ -84,7 +91,7 @@ class MagneticDividerUtils {
                    // opposed to "effects" movement).
                    spatialDirectionalMotionSpec(
                        initialMapping = Mapping.Fixed(topLeftDismissPosition),
                        semantics = listOf(SNAP_POSITION_KEY with null),
                        semantics = listOf(SNAP_POSITION_KEY_IDENTITY with null),
                        defaultSpring = MagneticSpring
                    ) {
                        // NOTE: This block is a trailing lambda passed in as the "init" parameter.
@@ -140,7 +147,7 @@ class MagneticDividerUtils {
                            // Create another identity zone.
                            identity(
                                breakpoint = targetPosition + snapThreshold,
                                semantics = listOf(SNAP_POSITION_KEY with null)
                                semantics = listOf(SNAP_POSITION_KEY_IDENTITY with null)
                            )
                        }

@@ -151,7 +158,7 @@ class MagneticDividerUtils {
                        fixedValue(
                            breakpoint = bottomRightDismissPosition,
                            value = bottomRightDismissPosition,
                            semantics = listOf(SNAP_POSITION_KEY with null)
                            semantics = listOf(SNAP_POSITION_KEY_IDENTITY with null)
                        )
                    }
                }