Assigned
Status Update
Comments
da...@gmail.com <da...@gmail.com> #2
Able to reproduce the issue from your description, video attached (though I'm not able to see yours, I assume they're similar).
mi...@gmail.com <mi...@gmail.com> #3
The problem is that when the list shortens to be smaller than the viewport, the AsyncPagedListDiffer doesn't receive any signals that tell it that more needs to be loaded - it currently only loads in response to getItem(). Will fix this, but in the meantime you can workaround this by calling getItem() in onCurrentListChanged:
class MyAdapter extends PagedListAdapter<...> {
int lastPos = 0;
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
lastPos = position;
// ... regular bind code ...
}
@Override
public void onCurrentListChanged(@Nullable PagedList<Item> currentList) {
// trigger load around most recently bound item
getItem(Math.min(lastPos, getItemCount() - 1));
}
}
class MyAdapter extends PagedListAdapter<...> {
int lastPos = 0;
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
lastPos = position;
// ... regular bind code ...
}
@Override
public void onCurrentListChanged(@Nullable PagedList<Item> currentList) {
// trigger load around most recently bound item
getItem(Math.min(lastPos, getItemCount() - 1));
}
}
Description
If you are creating a new Android Gradle Plugin Ninja build script, this is the place to discuss and log small issues.
For larger issues, please open Android Studio and click Help/Submit Feedback. Be sure to reference 'Custom C/C++ Build Systems' to help direct the bug.
Alternatively, you can create a bug with this link , but it will have less diagnostic information.