Status Update
Comments
ch...@google.com <ch...@google.com> #2
With paging2 and the PagedListAdapter, I was simply checking if the list was empty before sending it to the adapter so I wasn't handle it with the adapter (which is probably wrong).
I tried to migrate to paging3 but I couldn't because I don't know how to check if the list is empty, as the PagingData that we send to the new adapter doesn't expose the list or an isEmpty method.
tc...@google.com <tc...@google.com> #3
Thanks for this, this is something we are definitely interested in! As a workaround, you can check adapter.itemCount
.
an...@google.com <an...@google.com>
b9...@gmail.com <b9...@gmail.com> #4
We have a sample snippet showing how to use adapter.itemCount
in this way, but forgot to link it in KDocs (whoops):
Will fix.
ap...@google.com <ap...@google.com> #5
To be clear, adapter.itemCount
will only work if placeholdersEnabled
is false
.
We held off on this change because we wanted to take some time to properly explore what it would look like to provide a public API to view the PagingState or the internal PageEvent stream, but it's clear there's immediate need for this.
In the meantime, here's an idea for a CL which adds a Boolean
to dataRefreshFlow
, which we could merge for alpha02:
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?