Loading packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt +0 −4 Original line number Diff line number Diff line Loading @@ -1024,10 +1024,6 @@ internal class NestedScrollHandlerImpl( val canStart = when (behavior) { NestedScrollBehavior.DuringTransitionBetweenScenes -> { canChangeScene = false // unused: added for consistency false } NestedScrollBehavior.EdgeNoPreview -> { canChangeScene = isZeroOffset isZeroOffset && hasNextScene(offsetAvailable) Loading packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/NestedScrollToScene.kt +0 −7 Original line number Diff line number Diff line Loading @@ -34,13 +34,6 @@ import androidx.compose.ui.platform.InspectorInfo * [nestedScrollToScene]. */ enum class NestedScrollBehavior(val canStartOnPostFling: Boolean) { /** * During scene transitions, if we are within * [SceneTransitionLayoutImpl.transitionInterceptionThreshold], the [SceneTransitionLayout] * consumes scroll events instead of the scrollable component. */ DuringTransitionBetweenScenes(canStartOnPostFling = false), /** * Overscroll will only be used by the [SceneTransitionLayout] to move to the next scene if the * gesture begins at the edge of the scrollable component (so that a scroll in that direction Loading packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/DraggableHandlerTest.kt +0 −15 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import androidx.compose.ui.unit.IntSize import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.Velocity import androidx.test.ext.junit.runners.AndroidJUnit4 import com.android.compose.animation.scene.NestedScrollBehavior.DuringTransitionBetweenScenes import com.android.compose.animation.scene.NestedScrollBehavior.EdgeAlways import com.android.compose.animation.scene.NestedScrollBehavior.EdgeNoPreview import com.android.compose.animation.scene.NestedScrollBehavior.EdgeWithPreview Loading Loading @@ -729,13 +728,6 @@ class DraggableHandlerTest { nestedScroll.preFling(available = Velocity(0f, velocityThreshold)) } @Test fun flingAfterScroll_DuringTransitionBetweenScenes_doNothing() = runGestureTest { flingAfterScroll(use = DuringTransitionBetweenScenes, idleAfterScroll = true) assertIdle(currentScene = SceneA) } @Test fun flingAfterScroll_EdgeNoOverscroll_goToNextScene() = runGestureTest { flingAfterScroll(use = EdgeNoPreview, idleAfterScroll = false) Loading Loading @@ -788,13 +780,6 @@ class DraggableHandlerTest { nestedScroll.preFling(available = Velocity(0f, velocityThreshold)) } @Test fun flingAfterScrollStartedInScene_DuringTransitionBetweenScenes_doNothing() = runGestureTest { flingAfterScrollStartedInScene(use = DuringTransitionBetweenScenes, idleAfterScroll = true) assertIdle(currentScene = SceneA) } @Test fun flingAfterScrollStartedInScene_EdgeNoOverscroll_doNothing() = runGestureTest { flingAfterScrollStartedInScene(use = EdgeNoPreview, idleAfterScroll = true) Loading packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/NestedScrollToSceneTest.kt +10 −32 Original line number Diff line number Diff line Loading @@ -132,33 +132,6 @@ class NestedScrollToSceneTest { assertThat(transition).hasProgress(1.5f) } @Test fun customizeStlNestedScrollBehavior_DuringTransitionBetweenScenes() { var canScroll = true val state = setup2ScenesAndScrollTouchSlop { Modifier.verticalNestedScrollToScene( bottomBehavior = NestedScrollBehavior.DuringTransitionBetweenScenes ) .scrollable(rememberScrollableState { if (canScroll) it else 0f }, Vertical) } scrollUp(percent = 0.5f) assertThat(state.transitionState).isIdle() // Reach the end of the scrollable element canScroll = false scrollUp(percent = 0.5f) assertThat(state.transitionState).isIdle() pointerUp() assertThat(state.transitionState).isIdle() // Start a new gesture pointerDownAndScrollTouchSlop() scrollUp(percent = 0.5f) assertThat(state.transitionState).isIdle() } @Test fun customizeStlNestedScrollBehavior_EdgeNoPreview() { var canScroll = true Loading Loading @@ -253,19 +226,24 @@ class NestedScrollToSceneTest { @Test fun customizeStlNestedScrollBehavior_multipleRequests() { var canScroll = true val state = setup2ScenesAndScrollTouchSlop { Modifier // This verticalNestedScrollToScene is closer the STL (an ancestor node) .verticalNestedScrollToScene(bottomBehavior = NestedScrollBehavior.EdgeAlways) // Another verticalNestedScrollToScene modifier .verticalNestedScrollToScene( bottomBehavior = NestedScrollBehavior.DuringTransitionBetweenScenes ) .scrollable(rememberScrollableState { 0f }, Vertical) .verticalNestedScrollToScene(bottomBehavior = NestedScrollBehavior.EdgeNoPreview) .scrollable(rememberScrollableState { if (canScroll) it else 0f }, Vertical) } scrollUp(percent = 0.5f) // EdgeAlways always consume the remaining scroll, DuringTransitionBetweenScenes does not. assertThat(state.transitionState).isIdle() // Reach the end of the scrollable element canScroll = false scrollUp(percent = 0.5f) // EdgeAlways always consume the remaining scroll, EdgeNoPreview does not. val transition = assertThat(state.transitionState).isTransition() assertThat(transition).hasProgress(0.5f) } Loading Loading
packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt +0 −4 Original line number Diff line number Diff line Loading @@ -1024,10 +1024,6 @@ internal class NestedScrollHandlerImpl( val canStart = when (behavior) { NestedScrollBehavior.DuringTransitionBetweenScenes -> { canChangeScene = false // unused: added for consistency false } NestedScrollBehavior.EdgeNoPreview -> { canChangeScene = isZeroOffset isZeroOffset && hasNextScene(offsetAvailable) Loading
packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/NestedScrollToScene.kt +0 −7 Original line number Diff line number Diff line Loading @@ -34,13 +34,6 @@ import androidx.compose.ui.platform.InspectorInfo * [nestedScrollToScene]. */ enum class NestedScrollBehavior(val canStartOnPostFling: Boolean) { /** * During scene transitions, if we are within * [SceneTransitionLayoutImpl.transitionInterceptionThreshold], the [SceneTransitionLayout] * consumes scroll events instead of the scrollable component. */ DuringTransitionBetweenScenes(canStartOnPostFling = false), /** * Overscroll will only be used by the [SceneTransitionLayout] to move to the next scene if the * gesture begins at the edge of the scrollable component (so that a scroll in that direction Loading
packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/DraggableHandlerTest.kt +0 −15 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import androidx.compose.ui.unit.IntSize import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.Velocity import androidx.test.ext.junit.runners.AndroidJUnit4 import com.android.compose.animation.scene.NestedScrollBehavior.DuringTransitionBetweenScenes import com.android.compose.animation.scene.NestedScrollBehavior.EdgeAlways import com.android.compose.animation.scene.NestedScrollBehavior.EdgeNoPreview import com.android.compose.animation.scene.NestedScrollBehavior.EdgeWithPreview Loading Loading @@ -729,13 +728,6 @@ class DraggableHandlerTest { nestedScroll.preFling(available = Velocity(0f, velocityThreshold)) } @Test fun flingAfterScroll_DuringTransitionBetweenScenes_doNothing() = runGestureTest { flingAfterScroll(use = DuringTransitionBetweenScenes, idleAfterScroll = true) assertIdle(currentScene = SceneA) } @Test fun flingAfterScroll_EdgeNoOverscroll_goToNextScene() = runGestureTest { flingAfterScroll(use = EdgeNoPreview, idleAfterScroll = false) Loading Loading @@ -788,13 +780,6 @@ class DraggableHandlerTest { nestedScroll.preFling(available = Velocity(0f, velocityThreshold)) } @Test fun flingAfterScrollStartedInScene_DuringTransitionBetweenScenes_doNothing() = runGestureTest { flingAfterScrollStartedInScene(use = DuringTransitionBetweenScenes, idleAfterScroll = true) assertIdle(currentScene = SceneA) } @Test fun flingAfterScrollStartedInScene_EdgeNoOverscroll_doNothing() = runGestureTest { flingAfterScrollStartedInScene(use = EdgeNoPreview, idleAfterScroll = true) Loading
packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/NestedScrollToSceneTest.kt +10 −32 Original line number Diff line number Diff line Loading @@ -132,33 +132,6 @@ class NestedScrollToSceneTest { assertThat(transition).hasProgress(1.5f) } @Test fun customizeStlNestedScrollBehavior_DuringTransitionBetweenScenes() { var canScroll = true val state = setup2ScenesAndScrollTouchSlop { Modifier.verticalNestedScrollToScene( bottomBehavior = NestedScrollBehavior.DuringTransitionBetweenScenes ) .scrollable(rememberScrollableState { if (canScroll) it else 0f }, Vertical) } scrollUp(percent = 0.5f) assertThat(state.transitionState).isIdle() // Reach the end of the scrollable element canScroll = false scrollUp(percent = 0.5f) assertThat(state.transitionState).isIdle() pointerUp() assertThat(state.transitionState).isIdle() // Start a new gesture pointerDownAndScrollTouchSlop() scrollUp(percent = 0.5f) assertThat(state.transitionState).isIdle() } @Test fun customizeStlNestedScrollBehavior_EdgeNoPreview() { var canScroll = true Loading Loading @@ -253,19 +226,24 @@ class NestedScrollToSceneTest { @Test fun customizeStlNestedScrollBehavior_multipleRequests() { var canScroll = true val state = setup2ScenesAndScrollTouchSlop { Modifier // This verticalNestedScrollToScene is closer the STL (an ancestor node) .verticalNestedScrollToScene(bottomBehavior = NestedScrollBehavior.EdgeAlways) // Another verticalNestedScrollToScene modifier .verticalNestedScrollToScene( bottomBehavior = NestedScrollBehavior.DuringTransitionBetweenScenes ) .scrollable(rememberScrollableState { 0f }, Vertical) .verticalNestedScrollToScene(bottomBehavior = NestedScrollBehavior.EdgeNoPreview) .scrollable(rememberScrollableState { if (canScroll) it else 0f }, Vertical) } scrollUp(percent = 0.5f) // EdgeAlways always consume the remaining scroll, DuringTransitionBetweenScenes does not. assertThat(state.transitionState).isIdle() // Reach the end of the scrollable element canScroll = false scrollUp(percent = 0.5f) // EdgeAlways always consume the remaining scroll, EdgeNoPreview does not. val transition = assertThat(state.transitionState).isTransition() assertThat(transition).hasProgress(0.5f) } Loading