mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 12:47:26 +01:00
Fix post refreshing bug
Fix bug where the whole post disappears after refreshing it.
This commit is contained in:
parent
9d6e15edb7
commit
2fc4020b72
@ -1937,4 +1937,8 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
((TextView) itemView).setTextColor(mColorAccent);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearLoadedComments() {
|
||||
loadedComments.clear();
|
||||
}
|
||||
}
|
||||
|
@ -1408,17 +1408,12 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
|
||||
String suggestedCommentSort = "top";
|
||||
SortType.Type sortTypeType;
|
||||
if (suggestedCommentSort == null || suggestedCommentSort.equals("null") || suggestedCommentSort.equals("")) {
|
||||
mRespectSubredditRecommendedSortType = false;
|
||||
sortTypeType = loadSortType();
|
||||
} else {
|
||||
try {
|
||||
sortTypeType = SortType.Type.valueOf(suggestedCommentSort.toUpperCase(Locale.US));
|
||||
sortTypeType = SortType.Type.fromValue(suggestedCommentSort);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
sortTypeType = loadSortType();
|
||||
}
|
||||
}
|
||||
activity.setTitle(sortTypeType.fullName);
|
||||
ViewPostDetailFragment.this.sortType = sortTypeType;
|
||||
fetchComments(changeRefreshState, ViewPostDetailFragment.this.sortType);
|
||||
@ -1582,6 +1577,8 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
mSwipeRefreshLayout.setRefreshing(false);
|
||||
|
||||
if (fetchComments) {
|
||||
pages_loaded = 0;
|
||||
mCommentsAdapter.clearLoadedComments();
|
||||
fetchCommentsRespectRecommendedSort(true);
|
||||
} else {
|
||||
isRefreshing = false;
|
||||
|
Loading…
Reference in New Issue
Block a user