mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-06 18:57: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,16 +1408,11 @@ 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;
|
||||
try {
|
||||
sortTypeType = SortType.Type.fromValue(suggestedCommentSort);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
sortTypeType = loadSortType();
|
||||
} else {
|
||||
try {
|
||||
sortTypeType = SortType.Type.valueOf(suggestedCommentSort.toUpperCase(Locale.US));
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
sortTypeType = loadSortType();
|
||||
}
|
||||
}
|
||||
activity.setTitle(sortTypeType.fullName);
|
||||
ViewPostDetailFragment.this.sortType = sortTypeType;
|
||||
@ -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