Skip to content

Commit

Permalink
Fix for alternative setting
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonHalvdansson committed Oct 3, 2023
1 parent 5074f5e commit 1ffd53b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,12 @@ private void initializeRecyclerView() {

int offset = 0;
int lastChildIndex = adapter.getIndexOfLastChild(comment.depth, index);
if (index == lastChildIndex) {
if (index == lastChildIndex && !adapter.collapseParent) {
return;
}

final CommentsRecyclerViewAdapter.ItemViewHolder holder = ((CommentsRecyclerViewAdapter.ItemViewHolder) recyclerView.findViewHolderForAdapterPosition(index));
if (holder != null) {
if (holder != null && !adapter.collapseParent) {
//if we can reach the ViewHolder (which we should), we can animate the hiddenIndicator ourselves to get around a FULL item refresh (which flashes all the text which we don't want)
offset = 1;
final TextView hiddenIndicator = holder.commentHiddenCount;
Expand Down Expand Up @@ -499,7 +499,7 @@ public void onAnimationEnd(Animator animation) {

if (lastChildIndex != index || adapter.collapseParent) {
// + 1 since if we have 1 subcomment we have changed the parent and the child
adapter.notifyItemRangeChanged(index+offset, lastChildIndex - index + 1-offset);
adapter.notifyItemRangeChanged(index+1, lastChildIndex - index + 1-offset);
}

//next couple of lines makes it so that if we hide parents and click the comment at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private static List<Comment> populateChildComments(List<Comment> comments) {

private static void populateChildComments(List<Comment> comments, Comment comment, int startIndex) {
int targetDepth = comment.depth + 1;
comment.childComments = new ArrayList<Comment>();
comment.childComments = new ArrayList<>();
// Starting off after the comment, we don't go outside the array of course and stop if we reach a comment with depth smaller than the targetDepth
for (int i = startIndex + 1; i < comments.size() && comments.get(i).depth >= targetDepth; i++) {
// If we find something which has the target depth
Expand Down

0 comments on commit 1ffd53b

Please sign in to comment.