Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 32de9dd24cb6eff254b2147d4c8d83e5c2430959
Author: George Mount <mount@google.com>
Date: Wed Oct 05 14:51:06 2022
Add new gesture detector method for looping over gestures
Fixes: 251260206
Relnote: "A new method, awaitEachGesture(), for gesture detectors
was added. It operates similar to forEachGesture(), but the loop
over gestures operates entirely within the AwaitPointerEventScope
so events can't be lost between iterations.
forEachGesture() has been deprecated in favor of awaitEachGesture()
because it allows events to be lost between gestures."
Test: new tests
Change-Id: Iffc3fb8cf53d0e5eb9b529c023b3e2d29003e86f
M compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/ButtonMetaStateDemo.kt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/window/WindowDraggableArea.desktop.kt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ForEachGesture.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/TransformGestureDetector.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/AwaitEachGestureTest.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ExposedDropdownMenu.kt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TapGestureSamples.kt
M compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/AndroidOverscroll.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/TapGestureDetector.kt
M compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/RawDragGestureDetectorDemo.kt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/LongPressTextDragObserver.kt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/Scrollbar.desktop.kt
M compose/material3/material3/build.gradle
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/DragGestureDetector.kt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/DragGestureDetectorSamples.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/TextSelectionMouseDetector.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/ForEachGestureTest.kt
M compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/ColorPickerDemo.kt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TransformGestureSamples.kt
M compose/material/material/src/androidMain/kotlin/androidx/compose/material/ExposedDropdownMenu.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/ContextMenuProvider.desktop.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Transformable.kt
M compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SurfaceTest.kt
M compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/DragGestureDetectorTest.kt
M compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/DragSlopExceededGestureFilterDemo.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SurfaceTest.kt
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/Clickable.desktop.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/SuspendingGesturesDemo.kt
M compose/material/material/build.gradle
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PositionInWindowTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/AwaitTouchEventTest.kt
https://android-review.googlesource.com/2242251
Branch: androidx-main
commit 32de9dd24cb6eff254b2147d4c8d83e5c2430959
Author: George Mount <mount@google.com>
Date: Wed Oct 05 14:51:06 2022
Add new gesture detector method for looping over gestures
Fixes: 251260206
Relnote: "A new method, awaitEachGesture(), for gesture detectors
was added. It operates similar to forEachGesture(), but the loop
over gestures operates entirely within the AwaitPointerEventScope
so events can't be lost between iterations.
forEachGesture() has been deprecated in favor of awaitEachGesture()
because it allows events to be lost between gestures."
Test: new tests
Change-Id: Iffc3fb8cf53d0e5eb9b529c023b3e2d29003e86f
M compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/ButtonMetaStateDemo.kt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/window/WindowDraggableArea.desktop.kt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ForEachGesture.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/TransformGestureDetector.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/AwaitEachGestureTest.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ExposedDropdownMenu.kt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TapGestureSamples.kt
M compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/AndroidOverscroll.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/TapGestureDetector.kt
M compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/RawDragGestureDetectorDemo.kt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/LongPressTextDragObserver.kt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/Scrollbar.desktop.kt
M compose/material3/material3/build.gradle
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/DragGestureDetector.kt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/DragGestureDetectorSamples.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/TextSelectionMouseDetector.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/ForEachGestureTest.kt
M compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/ColorPickerDemo.kt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TransformGestureSamples.kt
M compose/material/material/src/androidMain/kotlin/androidx/compose/material/ExposedDropdownMenu.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/ContextMenuProvider.desktop.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Transformable.kt
M compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SurfaceTest.kt
M compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/DragGestureDetectorTest.kt
M compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/DragSlopExceededGestureFilterDemo.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SurfaceTest.kt
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/Clickable.desktop.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/SuspendingGesturesDemo.kt
M compose/material/material/build.gradle
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PositionInWindowTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/AwaitTouchEventTest.kt
na...@google.com <na...@google.com> #3
The following release(s) address this bug:
androidx.compose.foundation:foundation:1.4.0-alpha01
androidx.compose.material:material:1.4.0-alpha01
androidx.compose.ui:ui:1.4.0-alpha01
Description
forEachGesture
is an extension ofPointerInputScope
and has a lambda also onPointerInputScope
. It repeats the lambda, which must callawaitPointerEventScope
inside it to find gestures. On each loop, it must enter and exitAwaitPointerEventScope
and each time it exits, there is a chance that events get lost between gestures.We need a new method that loops wholly within
AwaitPointerEventScope
so that events aren't lost.forEachGesture
can't be deprecated because there are use cases where suspend functions or acoroutineScope
belongs within the lambda block. But most gesture detectors don't need that.