From 4cf401756f4207ae43238cde1522d18d6824b6c4 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sun, 13 Sep 2020 23:06:56 +0800 Subject: [PATCH] Fully collapsing comments with no children is available. --- .../Adapter/CommentAndPostRecyclerViewAdapter.java | 14 ++++++++++---- .../infinityforreddit/Comment/ParseComment.java | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 05e1d0c5..d765b067 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -567,7 +567,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter 0) { + mVisibleComments.subList(position + 1, position + 1 + allChildrenSize).clear(); + } if (mIsSingleCommentThreadMode) { if (mFullyCollapseComment) { notifyItemChanged(position + 2); @@ -3432,6 +3433,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter= 0 && commentPosition < mVisibleComments.size()) { + collapseChildren(commentPosition); + } } }); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/ParseComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/ParseComment.java index fc318e7d..b3c2932f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/ParseComment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/ParseComment.java @@ -102,6 +102,8 @@ public class ParseComment { c.setExpanded(true); } expandChildren(c.getChildren(), visibleComments, setExpanded); + } else { + c.setExpanded(true); } if (c.hasMoreChildrenFullnames() && c.getMoreChildrenFullnames().size() > c.getMoreChildrenStartingIndex()) { //Add a load more placeholder