diff options
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 |