Merge pull request #5891 from ByteHamster/fix-load-next-page

Fix 'load more' not detecting next page
This commit is contained in:
ByteHamster 2022-05-15 18:18:09 +02:00 committed by GitHub
commit e63c8f8125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) { public void onScrolled(@NonNull RecyclerView view, int deltaX, int deltaY) {
super.onScrolled(view, deltaX, deltaY); super.onScrolled(view, deltaX, deltaY);
boolean hasMorePages = feed != null && feed.isPaged() && feed.getNextPageLink() != null; boolean hasMorePages = feed != null && feed.isPaged() && feed.getNextPageLink() != null;
nextPageLoader.getRoot().setVisibility( boolean pageLoaderVisible = viewBinding.recyclerView.isScrolledToBottom() && hasMorePages;
(viewBinding.recyclerView.isScrolledToBottom() && hasMorePages) ? View.VISIBLE : View.GONE); 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 boolean deleteOnFailure = false;
private final long feedfileId; private final long feedfileId;
private final int feedfileType; private final int feedfileType;
private Bundle arguments = new Bundle(); private final Bundle arguments = new Bundle();
private boolean initiatedByUser = true; private boolean initiatedByUser = true;
public Builder(@NonNull String destination, @NonNull FeedMedia media) { public Builder(@NonNull String destination, @NonNull FeedMedia media) {
@ -288,6 +288,7 @@ public class DownloadRequest implements Parcelable {
this.title = feed.getHumanReadableIdentifier(); this.title = feed.getHumanReadableIdentifier();
this.feedfileId = feed.getId(); this.feedfileId = feed.getId();
this.feedfileType = feed.getTypeAsInt(); this.feedfileType = feed.getTypeAsInt();
arguments.putInt(REQUEST_ARG_PAGE_NR, feed.getPageNr());
} }
public Builder withInitiatedByUser(boolean initiatedByUser) { public Builder withInitiatedByUser(boolean initiatedByUser) {