Status Update
Comments
cl...@google.com <cl...@google.com> #2
just query LocalView instead of setting this metadata at the ComposeView layer to unblock the most common cases.
As we can't know when / if the ComposeView
is moved to a different part of the View
hierarchy, we don't have a good callback / place to update this value within ComposeView
- theoretically since shouldDelayChildPressedState
is a function, it could return different values at different points in time in any case. So we should instead continue to query the view hierarchy during a press, to see if at that point in time we should delay the press or not.
So instead we just need to provide whether there is a scrollable Compose node, and then consumers can combine querying that with whether there is a scrollable ViewGroup
, to work out whether they should delay presses or not. AndroidView
can solely query whether it is in a scrollable Compose node, as anything inside it will look up the view hierarchy anyway
cl...@google.com <cl...@google.com>
ma...@google.com <ma...@google.com> #3
Branch: androidx-main
commit b9c029ef8bc7d6abe73b72bc4fb00e02da90b366
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Mon Oct 18 23:43:49 2021
Delays PressInteractions if the Compose view is inside a scrolling ViewGroup
Updates ComposeView and other ViewGroups to correctly set shouldDelayChildPressedState to false
Bug:
Test: ClickableInScrollableViewGroupTest.kt
Change-Id: Ib7e000139d2bf39c9453fde38efbe2d84a6eac9a
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Toggleable.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/Clickable.desktop.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ClickableInScrollableViewGroupTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidViewsHandler.android.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ClickableTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/ComposeView.android.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/AndroidViewHolder.android.kt
M compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/Clickable.android.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Clickable.kt
ap...@google.com <ap...@google.com> #4
Branch: androidx-main
commit 262448965ac6cc81652e47e0a1534ae14ff7014e
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Mon Oct 18 17:18:06 2021
No longer delays PressInteractions within Modifier.scrollable()
As a result ripples in non-scrollable containers will now instantly start to ripple on a down event, instead of waiting for a delay.
Bug:
Test: tests
Relnote: "Ripples and other indications will now only be delayed if they are inside a Modifier.scrollable() container, instead of always being delayed for a down event."
Change-Id: Ibefe01bcdef89e01b6e9f7edf9fe13622450f487
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Toggleable.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CardTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ClickableTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ToggleableTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ButtonScreenshotTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/IndicationTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchScreenshotTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SurfaceTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/RadioButtonScreenshotTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CheckboxScreenshotTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/SelectableTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/FloatingActionButtonScreenshotTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Clickable.kt
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit ea035f9a4c64467bc175122c8f9efafae978080b
Author: Mariano Martin <marianomartin@google.com>
Date: Wed Mar 02 11:04:52 2022
Added a Modifier to query ancestors scroll info
Test: Added tests
Fixes: 223405612, 203141462
Relnote: """Added an Modifier API to query ancestors scroll info.
Used in Clickable to correctly delay press interactions, when getures could become scroll events.
Fixed Clickables not correctly delaying ripples, when used inside an Scrollable ViewGroup.
Updated Drawers and Sheets to correctly delay presses in case gestures can become scroll events.
"""
Change-Id: I2ba9d6d55f853e5d2775fe9a9f15e7a41d41e359
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ClickableInScrollableViewGroupTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableTest.kt
M compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/Clickable.android.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Clickable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Draggable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/Clickable.desktop.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt
M compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DismissibleNavigationDrawerTest.kt
M compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalNavigationDrawerTest.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_current.txt
A compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ScrollableContainerSample.kt
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/nestedscroll/ScrollContainerInfoTest.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/AndroidViewTest.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/ComposeViewTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/AndroidViewHolder.android.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/ScrollContainerInfo.kt
ap...@google.com <ap...@google.com> #6
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.foundation:foundation:1.4.0-alpha03
androidx.compose.material:material:1.4.0-alpha03
androidx.compose.material3:material3:1.1.0-alpha03
androidx.compose.ui:ui:1.4.0-alpha03
ma...@google.com <ma...@google.com> #7
We have clickable items within a swipeable Composable and have ended up applying a scrollable modifier which never scrolls in order to apply this local modifier and have the clickable items delay the ripple in case the user is performing a swipe.
If not should swipeable or draggable use the same modifier local to say the composable is inside a scrollable container?
Description