mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 20:57:25 +01:00
Expand all the children in a comment instead of expanding only the next level of comments.
This commit is contained in:
parent
aefc828036
commit
4521d3b0ce
@ -10,6 +10,7 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.style.SuperscriptSpan;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -956,8 +957,21 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
collapseChildren(commentPosition);
|
||||
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_more_grey_24dp);
|
||||
} else {
|
||||
expandChildren(commentPosition);
|
||||
//expandChildren(commentPosition);
|
||||
ArrayList<CommentData> newList = new ArrayList<>();
|
||||
eC(mVisibleComments.get(commentPosition).getChildren(), newList, 0);
|
||||
mVisibleComments.get(commentPosition).setExpanded(true);
|
||||
mVisibleComments.addAll(commentPosition + 1, newList);
|
||||
Log.i("adfasdf", "s " + newList.size());
|
||||
for (CommentData c : newList) {
|
||||
Log.i("adfasdf", "s " + c.getAuthor());
|
||||
}
|
||||
Log.i("adfasdf", "s " + commentPosition);
|
||||
if (mIsSingleCommentThreadMode) {
|
||||
notifyItemRangeInserted(commentPosition + 3, newList.size());
|
||||
} else {
|
||||
notifyItemRangeInserted(commentPosition + 2, newList.size());
|
||||
}
|
||||
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_less_grey_24dp);
|
||||
}
|
||||
}
|
||||
@ -1274,6 +1288,20 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
}
|
||||
}
|
||||
|
||||
private void eC(ArrayList<CommentData> comments, ArrayList<CommentData> newList, int position) {
|
||||
if (comments != null && comments.size() > 0) {
|
||||
newList.addAll(position, comments);
|
||||
int newPosition = position + 1;
|
||||
for (int i = 0; i < comments.size(); i++) {
|
||||
if (comments.get(i).getChildren() != null && comments.get(i).getChildren().size() > 0) {
|
||||
eC(comments.get(i).getChildren(), newList, newPosition);
|
||||
newPosition += comments.get(i).getChildren().size();
|
||||
}
|
||||
comments.get(i).setExpanded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void collapseChildren(int position) {
|
||||
mVisibleComments.get(position).setExpanded(false);
|
||||
int depth = mVisibleComments.get(position).getDepth();
|
||||
|
Loading…
Reference in New Issue
Block a user