Fixed
Status Update
Comments
ro...@gmail.com <ro...@gmail.com> #2
Any update on this?
The request is DiffUtil implementation along with "items" and "indexedItems" functions to support DiffUtil and animations when adding/removing items. the same as the ListAdapter with DiffUtil.
The request is DiffUtil implementation along with "items" and "indexedItems" functions to support DiffUtil and animations when adding/removing items. the same as the ListAdapter with DiffUtil.
ma...@google.com <ma...@google.com>
on...@aol.com <on...@aol.com> #3
We are working on it, but nothing to share yet. Thanks
sg...@google.com <sg...@google.com> #4
Are we allowed to post potential workarounds on issue trackers?
I created this small POC repo, definitely not a solution and probably not ideal in the long run but works for my use case and thought I'd share:
on...@aol.com <on...@aol.com> #5
I think there is not much point in coming up with workaround as this is expected to be one of the main features/supports for the DiffUtil (list diffing for adapters). Entire RecyclerView implementations depend on this.
sg...@google.com <sg...@google.com> #6
Any update on LazyList Animations
sg...@google.com <sg...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-main
commit 957064e95fb19d2e6f1312ff4ca4f7407ee3ee42
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Wed Oct 06 22:38:46 2021
Lazy list item reordering animation
Relnote: """Experimental ability to animate Lazy lists item positions was added.
There is a new modifier available within LazyItemScope called `Modifier.animateItemPlacement()`.
Usage example:
var list by remember { mutableStateOf(listOf("A", "B", "C")) }
LazyColumn {
item {
Button(onClick = { list = list.shuffled() }) {
Text("Shuffle")
}
}
items(list, key = { it }) {
Text("Item $it", Modifier.animateItemPlacement())
}
}
When you provide a key via `LazyListScope.item` or `LazyListScope.items` this modifier will enable item reordering animations. Aside from item reordering all other position changes caused by events like arrangement or alignment changes will also be animated.
"""
Bug: 150812265
Test: tests for the new behavior in LazyListAnimateItemPlacementTest
Change-Id: I59e7b8fd3a4a9eb19a15a4704da150bd187a6f24
A compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/PopularBooksDemo.kt
A compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListItemPlacementAnimator.kt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyItemScope.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyList.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasure.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListState.kt
M compose/foundation/foundation/api/1.1.0-beta02.txt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/LazyDslSamples.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyListAnimateItemPlacementTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListHeaders.kt
M compose/foundation/foundation/api/restricted_1.1.0-beta02.txt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/build.gradle
M compose/foundation/foundation/api/public_plus_experimental_1.1.0-beta02.txt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ListDemos.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyMeasuredItem.kt
https://android-review.googlesource.com/1823296
Branch: androidx-main
commit 957064e95fb19d2e6f1312ff4ca4f7407ee3ee42
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Wed Oct 06 22:38:46 2021
Lazy list item reordering animation
Relnote: """Experimental ability to animate Lazy lists item positions was added.
There is a new modifier available within LazyItemScope called `Modifier.animateItemPlacement()`.
Usage example:
var list by remember { mutableStateOf(listOf("A", "B", "C")) }
LazyColumn {
item {
Button(onClick = { list = list.shuffled() }) {
Text("Shuffle")
}
}
items(list, key = { it }) {
Text("Item $it", Modifier.animateItemPlacement())
}
}
When you provide a key via `LazyListScope.item` or `LazyListScope.items` this modifier will enable item reordering animations. Aside from item reordering all other position changes caused by events like arrangement or alignment changes will also be animated.
"""
Bug: 150812265
Test: tests for the new behavior in LazyListAnimateItemPlacementTest
Change-Id: I59e7b8fd3a4a9eb19a15a4704da150bd187a6f24
A compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/PopularBooksDemo.kt
A compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListItemPlacementAnimator.kt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyItemScope.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyList.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasure.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListState.kt
M compose/foundation/foundation/api/1.1.0-beta02.txt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/LazyDslSamples.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyListAnimateItemPlacementTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListHeaders.kt
M compose/foundation/foundation/api/restricted_1.1.0-beta02.txt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/build.gradle
M compose/foundation/foundation/api/public_plus_experimental_1.1.0-beta02.txt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ListDemos.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyMeasuredItem.kt
ma...@google.com <ma...@google.com> #8
The above modifier Modifier.animateItemPlacement() is very helpful for animating internal changes to the items existing in the lazy list but doesn't animate changes occurred during addition of items to the scope during runtime and it would be great if option would be provided for animating items upon entry to the activity/fragment/creation of the lazy list composable.
sg...@google.com <sg...@google.com> #10
In which version of Compose will the modifier be available?
sg...@google.com <sg...@google.com>
ap...@google.com <ap...@google.com> #11
in 1.1.0-beta03
Description
val scrollBehavior = remember { TopAppBarDefaults.enterAlwaysScrollBehavior() }
Scaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) // this makes scroll very slow and leggy
){
LazyColumn(
content = {}
)
}