mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 20:57:25 +01:00
Fix bugs of showing top-level comments.
This commit is contained in:
parent
802a70e9c9
commit
73980544db
@ -67,6 +67,10 @@ public class FetchComment {
|
|||||||
ArrayList<String> allChildren, int startingIndex,
|
ArrayList<String> allChildren, int startingIndex,
|
||||||
int depth, boolean expandChildren, Locale locale,
|
int depth, boolean expandChildren, Locale locale,
|
||||||
FetchMoreCommentListener fetchMoreCommentListener) {
|
FetchMoreCommentListener fetchMoreCommentListener) {
|
||||||
|
if (allChildren == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
if (allChildren.size() <= startingIndex + i) {
|
if (allChildren.size() <= startingIndex + i) {
|
||||||
|
@ -95,12 +95,15 @@ public class ParseComment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void expandChildren(ArrayList<CommentData> comments, ArrayList<CommentData> visibleComments) {
|
private static void expandChildren(ArrayList<CommentData> comments, ArrayList<CommentData> visibleComments,
|
||||||
|
boolean setExpanded) {
|
||||||
for (CommentData c : comments) {
|
for (CommentData c : comments) {
|
||||||
visibleComments.add(c);
|
visibleComments.add(c);
|
||||||
if (c.hasReply()) {
|
if (c.hasReply()) {
|
||||||
c.setExpanded(true);
|
if (setExpanded) {
|
||||||
expandChildren(c.getChildren(), visibleComments);
|
c.setExpanded(true);
|
||||||
|
}
|
||||||
|
expandChildren(c.getChildren(), visibleComments, setExpanded);
|
||||||
}
|
}
|
||||||
if (c.hasMoreChildrenFullnames() && c.getMoreChildrenFullnames().size() > c.getMoreChildrenStartingIndex()) {
|
if (c.hasMoreChildrenFullnames() && c.getMoreChildrenFullnames().size() > c.getMoreChildrenStartingIndex()) {
|
||||||
//Add a load more placeholder
|
//Add a load more placeholder
|
||||||
@ -239,9 +242,7 @@ public class ParseComment {
|
|||||||
protected Void doInBackground(Void... voids) {
|
protected Void doInBackground(Void... voids) {
|
||||||
try {
|
try {
|
||||||
parseCommentRecursion(commentsJSONArray, newComments, moreChildrenFullnames, depth, locale);
|
parseCommentRecursion(commentsJSONArray, newComments, moreChildrenFullnames, depth, locale);
|
||||||
if (expandChildren) {
|
expandChildren(newComments, expandedNewComments, expandChildren);
|
||||||
expandChildren(newComments, expandedNewComments);
|
|
||||||
}
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
parseFailed = true;
|
parseFailed = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user