Merge "STL improve large appbar demo experience" into main
diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/nestedscroll/LargeTopAppBarNestedScrollConnection.kt b/packages/SystemUI/compose/scene/src/com/android/compose/nestedscroll/LargeTopAppBarNestedScrollConnection.kt
index a5be4dc..98a0017 100644
--- a/packages/SystemUI/compose/scene/src/com/android/compose/nestedscroll/LargeTopAppBarNestedScrollConnection.kt
+++ b/packages/SystemUI/compose/scene/src/com/android/compose/nestedscroll/LargeTopAppBarNestedScrollConnection.kt
@@ -48,8 +48,8 @@
orientation = Orientation.Vertical,
// When swiping up, the LargeTopAppBar will shrink (to [minHeight]) and the content will
// expand. Then, you can then scroll down the content.
- canStartPreScroll = { offsetAvailable, offsetBeforeStart, _ ->
- offsetAvailable < 0 && offsetBeforeStart == 0f && height() > minHeight()
+ canStartPreScroll = { offsetAvailable, _, _ ->
+ offsetAvailable < 0 && height() > minHeight()
},
// When swiping down, the content will scroll up until it reaches the top. Then, the
// LargeTopAppBar will expand until it reaches its [maxHeight].
diff --git a/packages/SystemUI/compose/scene/tests/src/com/android/compose/nestedscroll/LargeTopAppBarNestedScrollConnectionTest.kt b/packages/SystemUI/compose/scene/tests/src/com/android/compose/nestedscroll/LargeTopAppBarNestedScrollConnectionTest.kt
index e27f9b5..c8fb2cb 100644
--- a/packages/SystemUI/compose/scene/tests/src/com/android/compose/nestedscroll/LargeTopAppBarNestedScrollConnectionTest.kt
+++ b/packages/SystemUI/compose/scene/tests/src/com/android/compose/nestedscroll/LargeTopAppBarNestedScrollConnectionTest.kt
@@ -71,41 +71,6 @@
}
@Test
- fun onScrollUpAfterContentScrolled_ignoreUpEvent() {
- val scrollConnection = buildScrollConnection(heightRange = 0f..2f)
- height = 1f
-
- // scroll down consumed by a child
- scrollConnection.scroll(available = Offset(0f, 1f), consumedByScroll = Offset(0f, 1f))
-
- val offsetConsumed =
- scrollConnection.onPreScroll(available = Offset(x = 0f, y = -1f), source = scrollSource)
-
- // It should ignore all onPreScroll events
- assertThat(offsetConsumed).isEqualTo(Offset.Zero)
- assertThat(height).isEqualTo(1f)
- }
-
- @Test
- fun onScrollUpAfterContentReturnedToZero_consumeHeight() {
- val scrollConnection = buildScrollConnection(heightRange = 0f..2f)
- height = 1f
-
- // scroll down consumed by a child
- scrollConnection.scroll(available = Offset(0f, 1f), consumedByScroll = Offset(0f, 1f))
-
- // scroll up consumed by a child, the child is in its original position
- scrollConnection.scroll(available = Offset(0f, -1f), consumedByScroll = Offset(0f, -1f))
-
- val offsetConsumed =
- scrollConnection.onPreScroll(available = Offset(x = 0f, y = -1f), source = scrollSource)
-
- // It should ignore all onPreScroll events
- assertThat(offsetConsumed).isEqualTo(Offset(0f, -1f))
- assertThat(height).isEqualTo(0f)
- }
-
- @Test
fun onScrollUp_consumeDownToMin() {
val scrollConnection = buildScrollConnection(heightRange = 0f..2f)
height = 0f