diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-09-13 15:06:56 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-09-13 15:06:56 +0000 |
commit | 4cf401756f4207ae43238cde1522d18d6824b6c4 (patch) | |
tree | 8d49f1d166ff284aa0bba09b488c65d312ebeda3 | |
parent | df1476692dc3cf4bc93ac8a02a58aecf046e532c (diff) | |
download | infinity-for-reddit-4cf401756f4207ae43238cde1522d18d6824b6c4.tar infinity-for-reddit-4cf401756f4207ae43238cde1522d18d6824b6c4.tar.gz infinity-for-reddit-4cf401756f4207ae43238cde1522d18d6824b6c4.tar.bz2 infinity-for-reddit-4cf401756f4207ae43238cde1522d18d6824b6c4.tar.lz infinity-for-reddit-4cf401756f4207ae43238cde1522d18d6824b6c4.tar.xz infinity-for-reddit-4cf401756f4207ae43238cde1522d18d6824b6c4.tar.zst infinity-for-reddit-4cf401756f4207ae43238cde1522d18d6824b6c4.zip |
Fully collapsing comments with no children is available.
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<Recy return VIEW_TYPE_POST_DETAIL_GALLERY; default: return VIEW_TYPE_POST_DETAIL_TEXT_TYPE; - } } @@ -598,7 +597,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy Comment comment = mVisibleComments.get(position - 2); if (!comment.isPlaceHolder()) { - if (mFullyCollapseComment && comment.hasReply() && !comment.isExpanded() && comment.hasExpandedBefore()) { + if (mFullyCollapseComment && !comment.isExpanded() && comment.hasExpandedBefore()) { return VIEW_TYPE_COMMENT_FULLY_COLLAPSED; } return VIEW_TYPE_COMMENT; @@ -616,7 +615,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy Comment comment = mVisibleComments.get(position - 1); if (!comment.isPlaceHolder()) { - if (mFullyCollapseComment && comment.hasReply() && !comment.isExpanded() && comment.hasExpandedBefore()) { + if (mFullyCollapseComment && !comment.isExpanded() && comment.hasExpandedBefore()) { return VIEW_TYPE_COMMENT_FULLY_COLLAPSED; } return VIEW_TYPE_COMMENT; @@ -1552,7 +1551,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy } } - mVisibleComments.subList(position + 1, position + 1 + allChildrenSize).clear(); + if (allChildrenSize > 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<Recy expandButton.setImageResource(R.drawable.ic_expand_less_grey_24dp); } } + } else if (mFullyCollapseComment) { + int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1; + if (commentPosition >= 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 |