Status Update
Comments
jg...@google.com <jg...@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
jg...@google.com <jg...@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
Description
Version used: 1.0.0-beta01
Devices/Android versions reproduced on: Compilation
After upgrading, I quickly got the following erros on my CI :
After checking a bit which dependency include jacocoagent, I found two culprits (Navigation Component which I reported here
| \--- androidx.viewpager2:viewpager2:1.0.0-alpha06 -> 1.0.0-beta01
| +--- org.jacoco:org.jacoco.agent:0.8.3
| +--- androidx.annotation:annotation:1.1.0
| +--- androidx.fragment:fragment:1.1.0-rc01 -> 1.2.0-alpha01 (*)
| +--- androidx.recyclerview:recyclerview:1.1.0-beta01 (*)
| +--- androidx.core:core:1.1.0-rc01 -> 1.2.0-alpha02 (*)
| \--- androidx.collection:collection:1.1.0 (*)
Is that normal ? If it is, what can we do to avoid lint from failing ?