Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Thanks! This looks like a bug, thank you for reporting!
ap...@google.com <ap...@google.com> #3
I would also recommend setting the value to 10%. When you do that, the behavior is wild.
Dragging up to 10% or between 50% and 90% will cause it to snap back to the start anchor.
Dragging between 10% and 50% or past 90% will cause it to snap to the end anchor.
Dragging up to 10% or between 50% and 90% will cause it to snap back to the start anchor.
Dragging between 10% and 50% or past 90% will cause it to snap to the end anchor.
ra...@google.com <ra...@google.com>
ab...@gmail.com <ab...@gmail.com> #4
Project: platform/frameworks/support
Branch: androidx-main
Author: Jossi Wolf <
Link:
Update AnchoredDraggable target calculation logic
Expand for full commit details
Update AnchoredDraggable target calculation logic
We were previously relying on currentValue and the next closest anchor in the drag direction, but the simpler and more reliable way is to look at the left and right anchors as the window.
Relnote: Fixed a bug where positional thresholds passed to AnchoredDraggableDefaults.flingBehavior were not considered correctly in some scenarios.
Test: anchoredDraggable_fling_offsetPastHalfwayBetweenAnchors_beforePosThreshold_doesntAdvance
Bug: 367660226
Bug: 366003852
Change-Id: Ifdf0dfcf3d7ff8288affee56e7092bbed473d6ab
Files:
- M
compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableStateTest.kt
- D
compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableTestState.kt
- M
compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/AnchoredDraggable.kt
Hash: eff53304942e9fd4fa5382e0cf487a734c5b8d28
Date: Thu Sep 19 16:24:55 2024
Description
Add an API to specify groups of composables that should be treated as a focus group. ie, we give priority to the items within the group before we move focus to items outside the group.
Usecases:
Adjacent lists When we have two scrollable lists next to each other, we want to move focus among all the items of the first list before jumping to the next list. If we don't group all the items in a list into a focus cluster, then from the focus system's perspective the elements in both the lists are treated as siblings, and we move focus purely based on the location of the elements. This can lead to focus search to jump from the first list to the other one list to another before visiting all the items in a given list.
LazyLists When we reach the end of the lazylist, we need to ask the list to compose more items. However, if all the items in the LazyList are not treated as a group, after we visit all the visible items, we could potentially jump out of the list and move focus to another item because the focus system can't distinguish between items in a lazylist and items that are outside it.