From 9e6acd9a0d986e77846c206cd866c759970f8db1 Mon Sep 17 00:00:00 2001 From: Clayton Hickey Date: Thu, 28 May 2020 20:42:00 -0400 Subject: [PATCH] Added simple handling for pagination in CommentListTask --- .../java/io/lbry/browser/tasks/CommentListTask.java | 12 ++++++++---- .../browser/ui/findcontent/FileViewFragment.java | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/lbry/browser/tasks/CommentListTask.java b/app/src/main/java/io/lbry/browser/tasks/CommentListTask.java index 089c02fa..e64f0308 100644 --- a/app/src/main/java/io/lbry/browser/tasks/CommentListTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/CommentListTask.java @@ -17,12 +17,16 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class CommentListTask extends AsyncTask> { - private String claim; + private final int page; + private final int pageSize; + private final String claim; private ProgressBar progressBar; private CommentListHandler handler; private Exception error; - public CommentListTask(String claim, ProgressBar progressBar, CommentListHandler handler) { + public CommentListTask(int page, int pageSize, String claim, ProgressBar progressBar, CommentListHandler handler) { + this.page = page; + this.pageSize = pageSize; this.claim = claim; this.progressBar = progressBar; this.handler = handler; @@ -39,8 +43,8 @@ public class CommentListTask extends AsyncTask> { Map options = new HashMap<>(); options.put("claim_id", claim); - options.put("page", 1); - options.put("page_size", 999); + options.put("page", page); + options.put("page_size", pageSize); options.put("include_replies", false); options.put("is_channel_signature_valid", true); options.put("visible", true); diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java index 2d1771ea..ae81c05e 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java @@ -1872,7 +1872,7 @@ public class FileViewFragment extends BaseFragment implements View root = getView(); ProgressBar relatedLoading = root.findViewById(R.id.file_view_comments_progress); if (claim != null && root != null) { - CommentListTask relatedTask = new CommentListTask(claim.getClaimId(), relatedLoading, new CommentListHandler() { + CommentListTask relatedTask = new CommentListTask(1, 999, claim.getClaimId(), relatedLoading, new CommentListHandler() { @Override public void onSuccess(List comments) { Context ctx = getContext();