diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/adapters/CommentsRecyclerViewAdapter.java b/app/src/main/java/eu/toldi/infinityforlemmy/adapters/CommentsRecyclerViewAdapter.java index 3ae83418..bb6251f9 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/adapters/CommentsRecyclerViewAdapter.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/adapters/CommentsRecyclerViewAdapter.java @@ -856,6 +856,16 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter newComments = new ArrayList<>(); + for (int i = 0; i < comments.size(); i++) { + if (loadedComments.contains(comments.get(i).getId())) { + continue; + } + newComments.add(comments.get(i)); + loadedComments.add(comments.get(i).getId()); + } + comments = (ArrayList) newComments; + int sizeBefore = mVisibleComments.size(); mVisibleComments.addAll(comments); for (int i = 0; i < comments.size(); i++) { diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/fragments/ViewPostDetailFragment.java b/app/src/main/java/eu/toldi/infinityforlemmy/fragments/ViewPostDetailFragment.java index 0232b13d..ec27cb6a 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/fragments/ViewPostDetailFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/fragments/ViewPostDetailFragment.java @@ -1450,6 +1450,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic @Override public void onFetchCommentSuccess(ArrayList expandedComments, Integer parentId, ArrayList children) { + isFetchingComments = false; ViewPostDetailFragment.this.children = children; pages_loaded++; comments = expandedComments; @@ -1508,8 +1509,6 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic if (changeRefreshState) { isRefreshing = false; } - - isFetchingComments = false; } @Override @@ -1535,8 +1534,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic isLoadingMoreChildren = true; - Retrofit retrofit = mAccessToken == null ? mRetrofit.getRetrofit() : mOauthRetrofit; - FetchComment.fetchComments(mExecutor, new Handler(), retrofit, mAccessToken, + FetchComment.fetchComments(mExecutor, new Handler(), mRetrofit.getRetrofit(), mAccessToken, mPost.getId(), null, sortType, mExpandChildren, pages_loaded + 1, new FetchComment.FetchCommentListener() { @Override public void onFetchCommentSuccess(ArrayList expandedComments, Integer parentId, ArrayList children) {