Fixed
Status Update
Comments
de...@gmail.com <de...@gmail.com> #2
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 8aea0fa4e7bed4d9dee1f03482328014e4dd86c2
Author: John Nichol <jnichol@google.com>
Date: Fri Oct 21 17:21:35 2022
Correct ScalingLazyListState.centerItemIndex calculation
Change the calculation of centerItemIndex/centerItemOffset to ensure that the closest item to the center of the viewport is returned.
The previous (incorrect) behaviour found the first items that had its itemEnd below the center line.
As a result it was possible in some edge conditions for an items which sat just above the center line to be ignored and the first items below the center line to be selected - even it was further away from the center line.
Bug: 254257769
Test: ./gradlew :wear:compose:compose-material:connectedCheck --info --daemon
Relnote: "We have corrected the calculation of `ScalingLazyListState.centerItemIndex/centerItemOffset` so that if two items sit either side of the viewport center line the one that is closest will be considered as the centerItem."
Change-Id: I307091167e04914d1ae29d5324f84ec18ed7b8a8
M wear/compose/compose-material/src/androidAndroidTest/kotlin/androidx/wear/compose/material/ScalingLazyListLayoutInfoTest.kt
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/ScalingLazyListItemInfo.kt
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/ScalingLazyListState.kt
M wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ScalingLazyColumnDemo.kt
https://android-review.googlesource.com/2263181
Branch: androidx-main
commit 8aea0fa4e7bed4d9dee1f03482328014e4dd86c2
Author: John Nichol <jnichol@google.com>
Date: Fri Oct 21 17:21:35 2022
Correct ScalingLazyListState.centerItemIndex calculation
Change the calculation of centerItemIndex/centerItemOffset to ensure that the closest item to the center of the viewport is returned.
The previous (incorrect) behaviour found the first items that had its itemEnd below the center line.
As a result it was possible in some edge conditions for an items which sat just above the center line to be ignored and the first items below the center line to be selected - even it was further away from the center line.
Bug: 254257769
Test: ./gradlew :wear:compose:compose-material:connectedCheck --info --daemon
Relnote: "We have corrected the calculation of `ScalingLazyListState.centerItemIndex/centerItemOffset` so that if two items sit either side of the viewport center line the one that is closest will be considered as the centerItem."
Change-Id: I307091167e04914d1ae29d5324f84ec18ed7b8a8
M wear/compose/compose-material/src/androidAndroidTest/kotlin/androidx/wear/compose/material/ScalingLazyListLayoutInfoTest.kt
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/ScalingLazyListItemInfo.kt
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/ScalingLazyListState.kt
M wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ScalingLazyColumnDemo.kt
[Deleted User] <[Deleted User]> #4
jn...@google.com <jn...@google.com>
da...@gmail.com <da...@gmail.com> #6
da...@gmail.com <da...@gmail.com> #7
da...@gmail.com <da...@gmail.com> #8
na...@google.com <na...@google.com> #9
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.wear.compose:compose-material:1.1.0-rc01
Description
The code to determine the ScalingLazyListState.centerItemIndex has a flaw and could return the wrong item the center line of the viewport is between two items. The current code will find first item that either straddles or is below the center line.
Given that the gaps between items is typically a few dp in size this issues hasn't previously been noticed/reported.
The correct logic would be to find the item that straddles the center line or the item with its edge closest to the center.