Fix 'load more' not detecting next page

This commit is contained in:
ByteHamster 2022-05-14 17:07:45 +02:00
parent 8cac0c71e4
commit 0510539e29
2 changed files with 7 additions and 3 deletions

View File

@ -163,8 +163,11 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
public void onScrolled(@NonNull RecyclerView view, int deltaX, int deltaY) {
super.onScrolled(view, deltaX, deltaY);
boolean hasMorePages = feed != null && feed.isPaged() && feed.getNextPageLink() != null;
nextPageLoader.getRoot().setVisibility(
(viewBinding.recyclerView.isScrolledToBottom() && hasMorePages) ? View.VISIBLE : View.GONE);
boolean pageLoaderVisible = viewBinding.recyclerView.isScrolledToBottom() && hasMorePages;
nextPageLoader.getRoot().setVisibility(pageLoaderVisible ? View.VISIBLE : View.GONE);
viewBinding.recyclerView.setPadding(
viewBinding.recyclerView.getPaddingLeft(), 0, viewBinding.recyclerView.getPaddingRight(),
pageLoaderVisible ? nextPageLoader.getRoot().getMeasuredHeight() : 0);
}
});

View File

@ -271,7 +271,7 @@ public class DownloadRequest implements Parcelable {
private boolean deleteOnFailure = false;
private final long feedfileId;
private final int feedfileType;
private Bundle arguments = new Bundle();
private final Bundle arguments = new Bundle();
private boolean initiatedByUser = true;
public Builder(@NonNull String destination, @NonNull FeedMedia media) {
@ -288,6 +288,7 @@ public class DownloadRequest implements Parcelable {
this.title = feed.getHumanReadableIdentifier();
this.feedfileId = feed.getId();
this.feedfileType = feed.getTypeAsInt();
arguments.putInt(REQUEST_ARG_PAGE_NR, feed.getPageNr());
}
public Builder withInitiatedByUser(boolean initiatedByUser) {