diff options
4 files changed, 10 insertions, 58 deletions
diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt index 9c3896b90124..83db7248f9dd 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/DraggableHandler.kt @@ -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) diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/NestedScrollToScene.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/NestedScrollToScene.kt index 945043d8fe95..8a0e4627d10c 100644 --- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/NestedScrollToScene.kt +++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/NestedScrollToScene.kt @@ -35,13 +35,6 @@ import androidx.compose.ui.platform.InspectorInfo */ 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 * can no longer be consumed). If the gesture is partially consumed by the scrollable component, diff --git a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/DraggableHandlerTest.kt b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/DraggableHandlerTest.kt index dc5b2f78180f..6360f852de57 100644 --- a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/DraggableHandlerTest.kt +++ b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/DraggableHandlerTest.kt @@ -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 @@ -730,13 +729,6 @@ class DraggableHandlerTest { } @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) @@ -789,13 +781,6 @@ class DraggableHandlerTest { } @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) diff --git a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/NestedScrollToSceneTest.kt b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/NestedScrollToSceneTest.kt index d8a06f54e74b..ccefe3d38937 100644 --- a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/NestedScrollToSceneTest.kt +++ b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/NestedScrollToSceneTest.kt @@ -133,33 +133,6 @@ class NestedScrollToSceneTest { } @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 val state = setup2ScenesAndScrollTouchSlop { @@ -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) } |