Fixed
Status Update
Comments
cl...@google.com <cl...@google.com>
ap...@google.com <ap...@google.com> #2
I totally agree with you.
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.
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.
cl...@google.com <cl...@google.com> #3
Thanks for this, this is something we are definitely interested in! As a workaround, you can check adapter.itemCount
.
na...@google.com <na...@google.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.
Description
LazyList has method:
LazyListScope.items(count: Int, key: ((index: Int) -> Any)? = null, contentType: (index: Int) -> Any? = { null }, itemContent: @Composable LazyItemScope.(index: Int) -> Unit)
,which is called from
paging-compose
library method:LazyListScope.items(items: LazyPagingItems<T>, key: ((item: T) -> Any)? = null, itemContent: @Composable LazyItemScope.(value: T?) -> Unit)
It uses the default value of
{ null }
forcontentType
. Please make it settable, so that we might improve performance of our layout.