Fixed
Status Update
Comments
ma...@google.com <ma...@google.com>
ap...@google.com <ap...@google.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).
ap...@google.com <ap...@google.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));
}
}
ma...@google.com <ma...@google.com>
ch...@google.com <ch...@google.com> #4
In general, using a larger initial load size/prefetch distance avoids this problem as well.
We recommend page size to be several viewports worth of items (https://developer.android.com/reference/androidx/paging/PagedList.Config.Builder#setPageSize(int) ). If you follow that, you'll typically avoid this problem, as initial load size + prefetch are >= page size by default.
We recommend page size to be several viewports worth of items (
ma...@google.com <ma...@google.com>
pr...@google.com <pr...@google.com> #5
Fix merged, will likely go out after 2.0: https://android-review.googlesource.com/c/platform/frameworks/support/+/760841
Again though, I'd like to reiterate that the ideal fix is, on the app side, using a large enough initial load size that this doesn't happen.
Again though, I'd like to reiterate that the ideal fix is, on the app side, using a large enough initial load size that this doesn't happen.
Description
Due to b/309858620 we need a workaround for library profiles in pre agp 8.3.0-alpha15.
When not meeting min agp version, for libraries we can only always merge the profile for all build type and flavors and output it in
src/main/baseline-prof.txt
.