Fixed
Status Update
Comments
kl...@google.com <kl...@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)
}
ap...@google.com <ap...@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.
pr...@google.com <pr...@google.com> #4
Ok, filed
ju...@google.com <ju...@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
Description
The Android a11y framework defines to "Action to send an ime actionId which is from
ACTION_IME_ENTER
EditorInfo.actionId
."The Compose semantics system defines an
ImeAction
property that defines which action a node has configured, but noSemanticsAction
to actually invoke that action. We should add it, then wire it up to that action callback.