Fixed
Status Update
Comments
jn...@google.com <jn...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 279f93e9d18b9f6909f428e5bab1f349aba368c9
Author: John Nichol <jnichol@google.com>
Date: Mon Feb 28 19:20:25 2022
ScalingLazyListItemInfo - add unadjusted size
Because of the vagaries of float maths it is not safe to get the unanjusted size of a list item from its scaled size and scaling factor. So we are making it available in the ScalingLazyListItemInfo for developers to use if they need it. It can be used along with unadjustedOffset (already in the interface) to determine the location of an item before it was scaled.
Bug: 221079441
RelNote: "We have added unadjustedSize to the ScalingLazyListItemInfo as it is not safe to calculate the original item size using the scaled size and scaling factor due to float maths precision."
Test: ./gradlew :wear:compose:compose-material:connectedCheck --info --daemon
Change-Id: I54657254014989469bed08b6ef3859cab814b826
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/compose-material/api/current.txt
M wear/compose/compose-material/api/restricted_current.txt
M wear/compose/compose-material/api/public_plus_experimental_current.txt
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/ScalingLazyColumnMeasure.kt
https://android-review.googlesource.com/2002236
Branch: androidx-main
commit 279f93e9d18b9f6909f428e5bab1f349aba368c9
Author: John Nichol <jnichol@google.com>
Date: Mon Feb 28 19:20:25 2022
ScalingLazyListItemInfo - add unadjusted size
Because of the vagaries of float maths it is not safe to get the unanjusted size of a list item from its scaled size and scaling factor. So we are making it available in the ScalingLazyListItemInfo for developers to use if they need it. It can be used along with unadjustedOffset (already in the interface) to determine the location of an item before it was scaled.
Bug: 221079441
RelNote: "We have added unadjustedSize to the ScalingLazyListItemInfo as it is not safe to calculate the original item size using the scaled size and scaling factor due to float maths precision."
Test: ./gradlew :wear:compose:compose-material:connectedCheck --info --daemon
Change-Id: I54657254014989469bed08b6ef3859cab814b826
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/compose-material/api/current.txt
M wear/compose/compose-material/api/restricted_current.txt
M wear/compose/compose-material/api/public_plus_experimental_current.txt
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/ScalingLazyColumnMeasure.kt
Description
ScalingLazyListItemInfo currently has the size (after scaling of the item) but not the unadjustedSize. Unfortunately due to float maths is it possible (we have seen it in some examples) to get a situation where it is not possible to get back the original size of the item from the size (Int) and scale (Float).
Adding the unadjustedOffset to the ScalingLazyListItemInfo will allow developers to know both the pre and post scaled size of the item which they may need in their calculations