Loading packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt +6 −8 Original line number Diff line number Diff line Loading @@ -190,14 +190,12 @@ internal class DraggableHandlerImpl( private fun computeSwipes(startedPosition: Offset?, pointersDown: Int): Swipes { val fromSource = startedPosition?.let { position -> layoutImpl.swipeSourceDetector .source( layoutImpl.swipeSourceDetector.source( layoutImpl.lastSize, position.round(), layoutImpl.density, orientation, ) ?.resolve(layoutImpl.layoutDirection) } val upOrLeft = Loading packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/EdgeDetector.kt +7 −7 Original line number Diff line number Diff line Loading @@ -54,23 +54,23 @@ class FixedSizeEdgeDetector(val size: Dp) : SwipeSourceDetector { position: IntOffset, density: Density, orientation: Orientation, ): Edge? { ): Edge.Resolved? { val axisSize: Int val axisPosition: Int val topOrLeft: Edge val bottomOrRight: Edge val topOrLeft: Edge.Resolved val bottomOrRight: Edge.Resolved when (orientation) { Orientation.Horizontal -> { axisSize = layoutSize.width axisPosition = position.x topOrLeft = Edge.Left bottomOrRight = Edge.Right topOrLeft = Edge.Resolved.Left bottomOrRight = Edge.Resolved.Right } Orientation.Vertical -> { axisSize = layoutSize.height axisPosition = position.y topOrLeft = Edge.Top bottomOrRight = Edge.Bottom topOrLeft = Edge.Resolved.Top bottomOrRight = Edge.Resolved.Bottom } } Loading packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayout.kt +1 −1 Original line number Diff line number Diff line Loading @@ -475,7 +475,7 @@ interface SwipeSourceDetector { position: IntOffset, density: Density, orientation: Orientation, ): SwipeSource? ): SwipeSource.Resolved? } /** The result of performing a [UserAction]. */ Loading packages/SystemUI/compose/scene/src/com/android/systemui/communal/ui/compose/CommunalSwipeDetector.kt +4 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import kotlin.math.abs * SwipeSourceDetector} to enable fullscreen swipe handling to transition to and from the glanceable * hub. */ class CommunalSwipeDetector(private var lastDirection: SwipeSource? = null) : class CommunalSwipeDetector(private var lastDirection: SwipeSource.Resolved? = null) : SwipeSourceDetector, SwipeDetector { companion object { private const val TRAVEL_RATIO_THRESHOLD = .5f Loading @@ -44,15 +44,15 @@ class CommunalSwipeDetector(private var lastDirection: SwipeSource? = null) : position: IntOffset, density: Density, orientation: Orientation ): SwipeSource? { ): SwipeSource.Resolved? { return lastDirection } override fun detectSwipe(change: PointerInputChange): Boolean { if (change.positionChange().x > 0) { lastDirection = Edge.Left lastDirection = Edge.Resolved.Left } else { lastDirection = Edge.Right lastDirection = Edge.Resolved.Right } // Determine whether the ratio of the distance traveled horizontally to the distance Loading packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/FixedSizeEdgeDetectorTest.kt +10 −10 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ class FixedSizeEdgeDetectorTest { @Test fun horizontalEdges() { fun horizontalEdge(position: Int): Edge? = fun horizontalEdge(position: Int): Edge.Resolved? = detector.source( layoutSize, position = IntOffset(position, 0), Loading @@ -42,17 +42,17 @@ class FixedSizeEdgeDetectorTest { Orientation.Horizontal, ) assertThat(horizontalEdge(0)).isEqualTo(Edge.Left) assertThat(horizontalEdge(30)).isEqualTo(Edge.Left) assertThat(horizontalEdge(0)).isEqualTo(Edge.Resolved.Left) assertThat(horizontalEdge(30)).isEqualTo(Edge.Resolved.Left) assertThat(horizontalEdge(31)).isEqualTo(null) assertThat(horizontalEdge(69)).isEqualTo(null) assertThat(horizontalEdge(70)).isEqualTo(Edge.Right) assertThat(horizontalEdge(100)).isEqualTo(Edge.Right) assertThat(horizontalEdge(70)).isEqualTo(Edge.Resolved.Right) assertThat(horizontalEdge(100)).isEqualTo(Edge.Resolved.Right) } @Test fun verticalEdges() { fun verticalEdge(position: Int): Edge? = fun verticalEdge(position: Int): Edge.Resolved? = detector.source( layoutSize, position = IntOffset(0, position), Loading @@ -60,11 +60,11 @@ class FixedSizeEdgeDetectorTest { Orientation.Vertical, ) assertThat(verticalEdge(0)).isEqualTo(Edge.Top) assertThat(verticalEdge(30)).isEqualTo(Edge.Top) assertThat(verticalEdge(0)).isEqualTo(Edge.Resolved.Top) assertThat(verticalEdge(30)).isEqualTo(Edge.Resolved.Top) assertThat(verticalEdge(31)).isEqualTo(null) assertThat(verticalEdge(69)).isEqualTo(null) assertThat(verticalEdge(70)).isEqualTo(Edge.Bottom) assertThat(verticalEdge(100)).isEqualTo(Edge.Bottom) assertThat(verticalEdge(70)).isEqualTo(Edge.Resolved.Bottom) assertThat(verticalEdge(100)).isEqualTo(Edge.Resolved.Bottom) } } Loading
packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt +6 −8 Original line number Diff line number Diff line Loading @@ -190,14 +190,12 @@ internal class DraggableHandlerImpl( private fun computeSwipes(startedPosition: Offset?, pointersDown: Int): Swipes { val fromSource = startedPosition?.let { position -> layoutImpl.swipeSourceDetector .source( layoutImpl.swipeSourceDetector.source( layoutImpl.lastSize, position.round(), layoutImpl.density, orientation, ) ?.resolve(layoutImpl.layoutDirection) } val upOrLeft = Loading
packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/EdgeDetector.kt +7 −7 Original line number Diff line number Diff line Loading @@ -54,23 +54,23 @@ class FixedSizeEdgeDetector(val size: Dp) : SwipeSourceDetector { position: IntOffset, density: Density, orientation: Orientation, ): Edge? { ): Edge.Resolved? { val axisSize: Int val axisPosition: Int val topOrLeft: Edge val bottomOrRight: Edge val topOrLeft: Edge.Resolved val bottomOrRight: Edge.Resolved when (orientation) { Orientation.Horizontal -> { axisSize = layoutSize.width axisPosition = position.x topOrLeft = Edge.Left bottomOrRight = Edge.Right topOrLeft = Edge.Resolved.Left bottomOrRight = Edge.Resolved.Right } Orientation.Vertical -> { axisSize = layoutSize.height axisPosition = position.y topOrLeft = Edge.Top bottomOrRight = Edge.Bottom topOrLeft = Edge.Resolved.Top bottomOrRight = Edge.Resolved.Bottom } } Loading
packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SceneTransitionLayout.kt +1 −1 Original line number Diff line number Diff line Loading @@ -475,7 +475,7 @@ interface SwipeSourceDetector { position: IntOffset, density: Density, orientation: Orientation, ): SwipeSource? ): SwipeSource.Resolved? } /** The result of performing a [UserAction]. */ Loading
packages/SystemUI/compose/scene/src/com/android/systemui/communal/ui/compose/CommunalSwipeDetector.kt +4 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import kotlin.math.abs * SwipeSourceDetector} to enable fullscreen swipe handling to transition to and from the glanceable * hub. */ class CommunalSwipeDetector(private var lastDirection: SwipeSource? = null) : class CommunalSwipeDetector(private var lastDirection: SwipeSource.Resolved? = null) : SwipeSourceDetector, SwipeDetector { companion object { private const val TRAVEL_RATIO_THRESHOLD = .5f Loading @@ -44,15 +44,15 @@ class CommunalSwipeDetector(private var lastDirection: SwipeSource? = null) : position: IntOffset, density: Density, orientation: Orientation ): SwipeSource? { ): SwipeSource.Resolved? { return lastDirection } override fun detectSwipe(change: PointerInputChange): Boolean { if (change.positionChange().x > 0) { lastDirection = Edge.Left lastDirection = Edge.Resolved.Left } else { lastDirection = Edge.Right lastDirection = Edge.Resolved.Right } // Determine whether the ratio of the distance traveled horizontally to the distance Loading
packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/FixedSizeEdgeDetectorTest.kt +10 −10 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ class FixedSizeEdgeDetectorTest { @Test fun horizontalEdges() { fun horizontalEdge(position: Int): Edge? = fun horizontalEdge(position: Int): Edge.Resolved? = detector.source( layoutSize, position = IntOffset(position, 0), Loading @@ -42,17 +42,17 @@ class FixedSizeEdgeDetectorTest { Orientation.Horizontal, ) assertThat(horizontalEdge(0)).isEqualTo(Edge.Left) assertThat(horizontalEdge(30)).isEqualTo(Edge.Left) assertThat(horizontalEdge(0)).isEqualTo(Edge.Resolved.Left) assertThat(horizontalEdge(30)).isEqualTo(Edge.Resolved.Left) assertThat(horizontalEdge(31)).isEqualTo(null) assertThat(horizontalEdge(69)).isEqualTo(null) assertThat(horizontalEdge(70)).isEqualTo(Edge.Right) assertThat(horizontalEdge(100)).isEqualTo(Edge.Right) assertThat(horizontalEdge(70)).isEqualTo(Edge.Resolved.Right) assertThat(horizontalEdge(100)).isEqualTo(Edge.Resolved.Right) } @Test fun verticalEdges() { fun verticalEdge(position: Int): Edge? = fun verticalEdge(position: Int): Edge.Resolved? = detector.source( layoutSize, position = IntOffset(0, position), Loading @@ -60,11 +60,11 @@ class FixedSizeEdgeDetectorTest { Orientation.Vertical, ) assertThat(verticalEdge(0)).isEqualTo(Edge.Top) assertThat(verticalEdge(30)).isEqualTo(Edge.Top) assertThat(verticalEdge(0)).isEqualTo(Edge.Resolved.Top) assertThat(verticalEdge(30)).isEqualTo(Edge.Resolved.Top) assertThat(verticalEdge(31)).isEqualTo(null) assertThat(verticalEdge(69)).isEqualTo(null) assertThat(verticalEdge(70)).isEqualTo(Edge.Bottom) assertThat(verticalEdge(100)).isEqualTo(Edge.Bottom) assertThat(verticalEdge(70)).isEqualTo(Edge.Resolved.Bottom) assertThat(verticalEdge(100)).isEqualTo(Edge.Resolved.Bottom) } }