Status Update
Comments
se...@candybytes.com <se...@candybytes.com> #2
Thanks! This looks like a bug, thank you for reporting!
an...@google.com <an...@google.com>
an...@google.com <an...@google.com> #3
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.
ap...@google.com <ap...@google.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
na...@google.com <na...@google.com> #5
mi...@gmail.com <mi...@gmail.com> #6
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.foundation:foundation:1.8.0-alpha04
androidx.compose.foundation:foundation-android:1.8.0-alpha04
androidx.compose.foundation:foundation-jvmstubs:1.8.0-alpha04
an...@google.com <an...@google.com> #7
Using the new version 1.8.0-alpha04
does not seem to resolve the issue for me. I tested with the same setting as the reported issue:
// it doesn't matter what you put here a the multiplier, the positionalThreshold is always 50%
positionalThreshold = { d -> d * 0.9f },
velocityThreshold = { Float.POSITIVE_INFINITY },
ju...@google.com <ju...@google.com> #8
Same. I've run this again on 1.8.0-alpha04. When using
positionalThreshold = { d -> d * 0.1f }
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.
I would expect It to only return if dragged less than or equal to 10% and snap to the end if dragged greater than 10%.
When using
positionalThreshold = { d -> d * 0.9f }
It acts as if the threshold has been set to 50%.
From what I can tell, nothing has changed about the behavior.
Description
Jetpack Compose component(s) used: androidxCompose = "1.3.0-rc01" androidxComposeCompiler = "1.3.2" androidxComposeMaterial3 = "1.0.0-alpha13" androidxComposeMaterial = "1.2.1"
Android Studio Build: Build #AI-222.4167.29.2221.9133400, built on October 4, 2022
Kotlin version: kotlin = "1.7.20"
Steps to Reproduce or Code Sample to Reproduce:
I struggle with a "Key" problem since I updated from androidx.compose "1.3.0-beta03" to "1.3.0-rc01".
I use LazyPagingItems for a LazyVerticalGrid and i add items like this in the LazyGridScope:
But since the library update, when I filter the content (so the paging items are updated in the flow), it throws an Exception. This exception wasn't thrown in the beta03 library version.
Because paging data is changing and elements become null while loading I can't supply a unique key, the App crashes. Is this a bug in the library or what exactly is the best practice when using LazyPagingItems that can change over time if you'd like to work with keys in the LazyGrid?
Stack trace (if applicable):