Fix cached

This commit is contained in:
Thomas 2022-10-21 15:29:21 +02:00
parent aedb81d0e5
commit 3d4f075c9c
2 changed files with 7 additions and 0 deletions

View file

@ -358,6 +358,9 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
private void initializeStatusesCommonView(final Statuses statuses) {
flagLoading = false;
if (binding == null || !isAdded() || getActivity() == null) {
if (binding != null) {
binding.loader.setVisibility(View.GONE);
}
return;
}
binding.loader.setVisibility(View.GONE);
@ -643,6 +646,9 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
}
private void getCachedStatus(DIRECTION direction, boolean fetchingMissing, TimelinesVM.TimelineParams timelineParams) {
if (getView() == null) {
return;
}
if (direction == null) {
timelinesVM.getTimelineCache(timelineStatuses, timelineParams)
.observe(getViewLifecycleOwner(), statusesCached -> {

View file

@ -461,6 +461,7 @@ public class TimelinesVM extends AndroidViewModel {
List<Status> notPresentStatuses = new ArrayList<>();
for (Status status : statuses.statuses) {
if (!timelineStatuses.contains(status)) {
status.cached = true;
notPresentStatuses.add(status);
}
}