Fixed
Status Update
Comments
ra...@google.com <ra...@google.com> #2
Describing use case. Currently I have a following layout:
Box {
val state = rememberLazyListState()
LazyColumn(state) {
...
}
ThreeButtons(state)
}
In this example overscroll effect applied only to LazyColumn
, and because ThreeButtons
are outside of LazyColumn
, overscroll effect isn't applied to it. But ThreeButtons
are listening to the list scroll, and visually it looks like buttons are within the list. Video, attached to original description of the isue shows how it looks like.
But if I hoist overScrollController outside of LazyColumn
, I can achieve overscroll effect to be applied to buttons as well:
val overScrollController = ScrollableDefaults.overScrollController()
Box(Modifier.overScroll(overScrollController)) {
CompositionLocalProvider(LocalOverScrollConfiguration provides null) {
LazyColumn(state, overScrollController = overScrollController) {
...
}
}
ThreeButtons(state)
}
ra...@google.com <ra...@google.com> #3
I would vote for creating a separate feature request for it. This bug was intended to allow creating your own LazyColumn like components. How to customize the existing LazyColumn is a separate issue.
To add more context on this issue though, we we were thinking how to correctly implement something similar to item decorators. For example to draw lines between cells in LazyVerticalGrids. Theoretically it is possible via just adding Modifier.drawBehind {} oh it where in the draw block we read LazyGridState.layoutInfo and draw what we need according to it. However such drawing will not be moved with the content when overscroll happens in the same way as with ThreeButtons in the example.
To add more context on this issue though, we we were thinking how to correctly implement something similar to item decorators. For example to draw lines between cells in LazyVerticalGrids. Theoretically it is possible via just adding Modifier.drawBehind {} oh it where in the draw block we read LazyGridState.layoutInfo and draw what we need according to it. However such drawing will not be moved with the content when overscroll happens in the same way as with ThreeButtons in the example.
cl...@google.com <cl...@google.com> #4
Ok, filed
ra...@google.com <ra...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit 44ff305ba4ca7d70ea047c84c36968a30cd290d9
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Mon Jun 06 19:57:46 2022
Add the ability to customise the overscroll on scrollable.
In order to customise the over scroll effect, the experimental OverscrollEffect has been exposed, as well as the default method to general the platform default for over scroll logic.
OverscrollEffect APIs have been revamped and changed to accommodate more usecases.
Test: ScrollableTest + OverscrollTest have been adjusted, the coverage was here already.
Bug: 204650733
Relnote: An experimental OverscrollEffect has been introduced to allow for custom overscroll effects, alongside the Modifier.scrollable overloads that accept it.
Relnote: Experimental LocalOverScrollConfiguration has been moved from foundation.gesture to foundation package and renamed to LocalOverscrollConfiguration
Change-Id: If19fb8063922eddf1ffcb020ec6a8fbe48471ccf
A compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/OverscrollSample.kt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/HighLevelGesturesDemo.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ClipScrollableContainer.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyList.kt
A compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/DesktopOverscroll.kt
M compose/foundation/foundation/api/current.ignore
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGrid.kt
M compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/AndroidOverscroll.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/OverscrollTest.kt
M compose/foundation/foundation/api/restricted_current.ignore
M compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/OverscrollConfiguration.kt
M compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/ComposeUiTestTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
A compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Overscroll.kt
D compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/OverScroll.kt
M compose/ui/ui-test-junit4/src/test/kotlin/androidx/compose/ui/test/junit4/RobolectricComposeTest.kt
M compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/EdgeEffectCompat.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/StretchOverscrollTest.kt
M compose/foundation/foundation/api/public_plus_experimental_1.2.0-beta04.txt
M compose/foundation/foundation/api/1.2.0-beta04.txt
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_1.2.0-beta04.txt
D compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/gestures/DesktopOverScroll.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/OverscrollScreenshotTest.kt
https://android-review.googlesource.com/2109265
Branch: androidx-main
commit 44ff305ba4ca7d70ea047c84c36968a30cd290d9
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Mon Jun 06 19:57:46 2022
Add the ability to customise the overscroll on scrollable.
In order to customise the over scroll effect, the experimental OverscrollEffect has been exposed, as well as the default method to general the platform default for over scroll logic.
OverscrollEffect APIs have been revamped and changed to accommodate more usecases.
Test: ScrollableTest + OverscrollTest have been adjusted, the coverage was here already.
Bug: 204650733
Relnote: An experimental OverscrollEffect has been introduced to allow for custom overscroll effects, alongside the Modifier.scrollable overloads that accept it.
Relnote: Experimental LocalOverScrollConfiguration has been moved from foundation.gesture to foundation package and renamed to LocalOverscrollConfiguration
Change-Id: If19fb8063922eddf1ffcb020ec6a8fbe48471ccf
A compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/OverscrollSample.kt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/HighLevelGesturesDemo.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ClipScrollableContainer.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyList.kt
A compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/DesktopOverscroll.kt
M compose/foundation/foundation/api/current.ignore
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGrid.kt
M compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/AndroidOverscroll.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/OverscrollTest.kt
M compose/foundation/foundation/api/restricted_current.ignore
M compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/OverscrollConfiguration.kt
M compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/ComposeUiTestTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
A compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Overscroll.kt
D compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/OverScroll.kt
M compose/ui/ui-test-junit4/src/test/kotlin/androidx/compose/ui/test/junit4/RobolectricComposeTest.kt
M compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/EdgeEffectCompat.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/StretchOverscrollTest.kt
M compose/foundation/foundation/api/public_plus_experimental_1.2.0-beta04.txt
M compose/foundation/foundation/api/1.2.0-beta04.txt
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_1.2.0-beta04.txt
D compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/gestures/DesktopOverScroll.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/OverscrollScreenshotTest.kt
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit 2e11ab7513f2bbe0f4e66ba7257c1d5e36327d8d
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Tue Jun 07 20:36:06 2022
Fix for Modifier.vertical[horizontal]Scroll() not setting Modifier.overscroll()
This is required when you provide overscrollEffect into Modifier.scrollable() as otherwise there is not attached anywhere OverscrollEffect with zero size which we try to scroll. This was causing crash because of dividing by zero width/height internally.
Bug: 204650733
Test: new test in ScrollTest
Change-Id: Ibdaca7f30d85bf5d3ab2c67cb7d5b7d6dcb8ada7
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
https://android-review.googlesource.com/2116811
Branch: androidx-main
commit 2e11ab7513f2bbe0f4e66ba7257c1d5e36327d8d
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Tue Jun 07 20:36:06 2022
Fix for Modifier.vertical[horizontal]Scroll() not setting Modifier.overscroll()
This is required when you provide overscrollEffect into Modifier.scrollable() as otherwise there is not attached anywhere OverscrollEffect with zero size which we try to scroll. This was causing crash because of dividing by zero width/height internally.
Bug: 204650733
Test: new test in ScrollTest
Change-Id: Ibdaca7f30d85bf5d3ab2c67cb7d5b7d6dcb8ada7
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
Description
The following Experimental APIs have existed for several releases.
Please consider stabilising or removing these APIs: