-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PagedListAdapter with multiple ViewHolders scroll bug #375
Comments
You're right about the insert notification - If you want items above the PagedListAdapter, switch to using AsyncPagedListDiffer, and pass a custom ItemCallback that offsets the positions by one:
|
Working like a charm. I missed that overload. |
Hi guys @kamgurgul @ChrisCraik , I am having this problem too and I don't know how to solve it, could anyone help me with the code ?
|
The scrolling problem is fixed with this:
When I swipe to refresh I get this:
If I comment this lines, it doesn't crash but it's not refreshing:
How can I solve this? |
@kamgurgul can u reopen this issue? |
If your header isn't a part of "PagedList" then you have bad "getItemCount()" implementation. You don't have additional element for a header. Just try to add 1. Anyway I think it isn't the right place for this issue :) |
@kamgurgul the header is part of the "PagedList", why do u think this is not the right place for the issue? |
I created a new issue @kamgurgul : Issue 548 Thanks for all |
I have tried implementing a simple header but now all my items except the header have disappeared. If anyone could take a look at what could be missing I would love to know: https://stackoverflow.com/questions/57853321/how-to-add-a-header-to-a-pagedlist-using-android-paging-library Edit: Ok I actually figured it out, I was using |
- A few changes related to a workaround proposed here => android/architecture-components-samples#375
Hello,
I tried to add custom header (as a separeated ViewHolder) to the RecyclerView with
PagedListAdapter
but in that configurationloadInitial()
(from DataSource) will caused automaticall scroll to the end of the loaded page (and it will trigger next load withloadRange()
). This behaviour can be easily reproduced by changing this line fromPostAdapter
in PagingWithNetworkSample:private fun hasExtraRow() = true // networkState != null && networkState != NetworkState.LOADED
.I assume it is caused by wrong insertion notification from
AsyncPagedListDiffer
. Position on the data list is not the same as in the adapter because there I have one extra item.How can I handle correctly this situation? Maybe some method in
PagedListAdapter
to calculate real data position would be helpful.The text was updated successfully, but these errors were encountered: