Status Update
Comments
ma...@google.com <ma...@google.com> #2
Thanks Alex,
This is definitely a reasonable request, we have this work planned, stay tuned :)
ki...@gmail.com <ki...@gmail.com> #3
Hey guys, is there any update on this? Will this be available in the 1.0?
ma...@google.com <ma...@google.com> #4
Hello. I'm afraid it won't be available for 1.0.
We're looking at the generic overscroll support in foundation, on of top which we will be able to build material/android-esque edge effect or a new overscroll experience. Given the scope of the task, we will start looking at this only after 1.0.
ki...@gmail.com <ki...@gmail.com> #5
That's cool, no worries, can always wrap a ComposeView in a ScrollView until then I guess ;)
ap...@google.com <ap...@google.com> #6
Branch: androidx-main
commit 48588ca4927b8277d21845a4e52c1d3d57c4d5b1
Author: Matvei Malkov <malkov@google.com>
Date: Thu Aug 05 16:52:08 2021
Add support for glowing overscroll.
This CL adds support for pre-stretch glowing overscroll in all types of default scrolling containers (LazyColumn, LazyRow, Modifier.verticalScroll, Modifier.horizontalScroll).
With the addition of the effect itself, this CL adds experimental android-only API to allow for customisations of this effect, for functionality to be on par with views glowing effect.
Bug: 171682480
Test: add new intergration and screenshot tests
Relnote: Glow effect for scroll has been added. New experimental OverScrollConfiguration API has been added to allow for configuration of the overscroll visual effect. Provide null to turn off the overscroll effect.
Change-Id: I0c3042f89365408e92f657330ed3164e6f3e12f8
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/DraggableTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableTest.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/OverScrollScreenshotTest.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/OverScrollTest.kt
A compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/gestures/AndroidOverScroll.kt
A compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/gestures/OverScrollConfiguration.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Draggable.kt
A compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/OverScroll.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyList.kt
A compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/gestures/DesktopOverScroll.kt
ap...@google.com <ap...@google.com> #7
Branch: androidx-main
commit 0ace9aa53ec295b8342b5f8fc16c11b29f105b82
Author: Matvei Malkov <malkov@google.com>
Date: Fri Aug 13 10:28:10 2021
Support for stretch overscroll [android S+] in Compose.
Adds support for stretch type effect on S+ devices, handling cases for pre scroll and pre fling accordingly to allow for better user experience.
Fixes: 171682480
Fixes: 197851813
Test: Added more tests for OverScrollController + dedicated StretchOverscrollTests
Relnote: Support for stretch overscroll has been added on android S devices.
Change-Id: Iccf3c3830a01469940828e21bc32b569951c187e
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/OverScroll.kt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/gestures/DesktopOverScroll.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/StretchOverscrollTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyList.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/OverScrollTest.kt
A compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/gestures/EdgeEffectCompat.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/gestures/AndroidOverScroll.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
am...@gmail.com <am...@gmail.com> #8
al...@gmail.com <al...@gmail.com> #9
Yes, it is available in the latest compose released yesterday
ma...@google.com <ma...@google.com> #10
Will there ever be support for Android 11 and below?
Stretch effect overscroll will be supported only for android 12 and above. For versions prior to that, the original glow edge overscroll will be shown.
This is done by design, so that overscroll in every app will feel the same, leaving users with the feel of consistency.
I hope that makes sense.
ku...@gmail.com <ku...@gmail.com> #11
ma...@google.com <ma...@google.com> #12
This looks broken indeed. I believe this should not happen if you are using latest snapshot where we properly support stretch effect. Could you share more information about this sample's setup? Compose version, code with snippet (is it LazyColumn, Modifier.verticalScroll or your own Modifier.scrollable) and any other relevant info.
Thanks.
ku...@gmail.com <ku...@gmail.com> #13
I used LazyColumn in compose_version = '1.1.0-alpha03'
. I just created a brand new project to test this, still the same issue. I am attaching android version,build number... if that helps.
//code snippet
@Composable
fun ScreenMain() {
LazyColumn(
modifier = Modifier.fillMaxSize(),
content = {
items(30) {
RowItem(number = it)
}
})
}
@Composable
fun RowItem(number: Int) {
Box(
modifier = Modifier
.fillMaxWidth()
.height(50.dp)
.padding(all = 8.dp)
.border(width = 1.dp, color = Color.Red),
contentAlignment = Alignment.Center,
) {
Text(text = "Row $number", color = Color.Black)
}
}
ma...@google.com <ma...@google.com> #14
Thanks for additional info.
I tried this example in the emulator, pixel 3 and some various Samsungs, and I cannot reproduce the issue for some reason.
There's a version check that prohibits any kind of overscroll for S devices on 1.1.0-alpha03.
Could you please try a real phone with android S if you have some? Or a fresh emulator image?
Alternatively, you can turn off overscroll for now and wait for alpha04 where stretch overscroll for S devices will be fully supported.
ku...@gmail.com <ku...@gmail.com> #15
Thanks for the reply. I reinstalled Android S Images and then created a new virtual device. Issue seems to be resolved now. Probably issue was with the S preview.
ma...@google.com <ma...@google.com> #16
Oh, that makes sense as well, as some S previews had incomplete support for stretch in the RenderNode, so it might have been broken there.
I'm glad that everything is working well for you now!
al...@gmail.com <al...@gmail.com> #17
Is the default material color correct for both light mode and dark mode? I see 0xff666666
hardcoded here:
But IIRC this color is themed using android:colorEdgeEffect
, for example here:
Might need to update MaterialTheme.kt
and the
ma...@google.com <ma...@google.com> #18
Yup, you are right.
The default color is design system agnostic. Since we're waiting for API feedback - we cannot wire up foundation glow api with material just yet. It will be done as soon as we will graduate OverScrollConfiguration from experimental.
you can do it manually for now in your app.
Description
On Android, over-scroll ripples show up by default on scrollable containers such as
ScrollView
andRecyclerView
. Internally they are implemented usingEdgeEffect
and their colors are typically customized in the application theme usingandroid:colorEdgeEffect
.I noticed this behavior does not seem to exist in Compose. It would be great if it could be supported to achieve parity with the traditional view system!
(I'm filing this under the
material
tracker because the default edge effect renders a ripple animation on Android, but I realize the scope of this likely falls under thefoundation
category as well).