Fixed
Status Update
Comments
ch...@google.com <ch...@google.com> #2
I had a play around with this today, and come up with this:
It builds upon Andrey's CL, and works around the 'pending item' issue. It also uses AsyncPagingDataDiffer so we're not re-implementing the diffing.
tc...@google.com <tc...@google.com> #3
This feature/bug is targeting an iteration that has already passed. Can you please update the status or move it to a future iteration? Thank you!
an...@google.com <an...@google.com>
b9...@gmail.com <b9...@gmail.com> #4
Any update here?
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit 2a414bdafd7b0364bd69293ac86481482a1a0210
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Mon Mar 15 15:59:25 2021
Make LazyPagingItems' itemCount and item getter observable
This change removes hack recomposerPlaceholder we had to trigger the recompositions. It allows LazyPagingItems usage outside of official item/itemIndexed functions, for example with experimental LazyVerticalGrid.
Also this should help with recompositions granularity. For example if we receive an event from Pager that the item 2 has been changed we can only recompose this item.
Relnote: LazyPagingItems' itemCount and item getter are now observable which allows it to be used with LazyVerticalGrid as well
Test: new tests in LazyPagingItemsTest
Bug: 171872064
Bug: 168285687
Change-Id: Ie24468ec51660c144acab71e8e520ac09d00b023
M paging/paging-compose/api/current.txt
M paging/paging-compose/api/public_plus_experimental_current.txt
M paging/paging-compose/api/restricted_current.txt
M paging/paging-compose/build.gradle
M paging/paging-compose/src/androidTest/java/androidx/paging/compose/LazyPagingItemsTest.kt
M paging/paging-compose/src/main/java/androidx/paging/compose/LazyPagingItems.kt
https://android-review.googlesource.com/1531912
Branch: androidx-main
commit 2a414bdafd7b0364bd69293ac86481482a1a0210
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Mon Mar 15 15:59:25 2021
Make LazyPagingItems' itemCount and item getter observable
This change removes hack recomposerPlaceholder we had to trigger the recompositions. It allows LazyPagingItems usage outside of official item/itemIndexed functions, for example with experimental LazyVerticalGrid.
Also this should help with recompositions granularity. For example if we receive an event from Pager that the item 2 has been changed we can only recompose this item.
Relnote: LazyPagingItems' itemCount and item getter are now observable which allows it to be used with LazyVerticalGrid as well
Test: new tests in LazyPagingItemsTest
Bug: 171872064
Bug: 168285687
Change-Id: Ie24468ec51660c144acab71e8e520ac09d00b023
M paging/paging-compose/api/current.txt
M paging/paging-compose/api/public_plus_experimental_current.txt
M paging/paging-compose/api/restricted_current.txt
M paging/paging-compose/build.gradle
M paging/paging-compose/src/androidTest/java/androidx/paging/compose/LazyPagingItemsTest.kt
M paging/paging-compose/src/main/java/androidx/paging/compose/LazyPagingItems.kt
Description
1) We can do the whole recomposition when the items count changed as we can't change size without the recomposition
2) But we can react on item changes only for the currently visible items.
I prototyped how it can work from the compose side:
But it has quite a lot of todos where I am not sure what callbacks from Paging to be using to update the compose states. Could you please help with figuring it out?