Fixed
Status Update
Comments
ma...@google.com <ma...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 188c9156ea6e42d9249cfa2c9df76a6af61fe7d1
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Thu Sep 17 15:30:34 2020
Improve LazyColumn/Row layout logic
Now we correctly support dynamically changing items count/sizes of the items.
Relnote: Fixed crash in LazyColumnFor/LazyRowFor after scrolling and then changing items and implemented auto scrolling up when the previously visible item was removed so we don't display empty gaps in the end anymore
Test: new tests for both columns and rows
Fixes: 161480164
Fixes: 167855468
Change-Id: I220abfb686295685653eb28019318ea671eb6755
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyColumnForTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyRowForTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyForState.kt
https://android-review.googlesource.com/1429830
Branch: androidx-master-dev
commit 188c9156ea6e42d9249cfa2c9df76a6af61fe7d1
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Thu Sep 17 15:30:34 2020
Improve LazyColumn/Row layout logic
Now we correctly support dynamically changing items count/sizes of the items.
Relnote: Fixed crash in LazyColumnFor/LazyRowFor after scrolling and then changing items and implemented auto scrolling up when the previously visible item was removed so we don't display empty gaps in the end anymore
Test: new tests for both columns and rows
Fixes: 161480164
Fixes: 167855468
Change-Id: I220abfb686295685653eb28019318ea671eb6755
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyColumnForTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyRowForTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyForState.kt
Description
I use a LazyColumnFor with expanding Contents. There are 4 collapsed Items, which will take up the entire screen when expanded. When all items are expanded and the user scrolls to the bottom of the screen, the items at the bottom could be expanded first. The expected (maybe intended) behaviour would be to automatically scroll up to fill the screen with items.
However LazyColumnFor does not automatically scroll up. It leaves some of the screen blank, which is (probably) due to the somewhat lazy measuring of the Layout.
(This behaviour (I think) can also cause issues, such as, when scrolled down, collapsing the topmost item (though I could not make this reproducible in the code sample below). This should be a known bug, but I do have a Stacktrace of it if necessary.)