fix crash on timeline reloading

main
Conny Duck 6 years ago
parent 51e2ccc5a5
commit a25eefcbeb
  1. 22
      app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java

@ -136,8 +136,6 @@ public class TimelineFragment extends SFragment implements
private boolean filterRemoveRegex;
private Matcher filterRemoveRegexMatcher;
private boolean hideFab;
private boolean topLoading;
private int topFetches;
private boolean bottomLoading;
@Nullable
@ -222,12 +220,9 @@ public class TimelineFragment extends SFragment implements
setupTimelinePreferences();
setupNothingView();
topLoading = false;
topFetches = 0;
bottomId = null;
topId = null;
if (statuses.isEmpty()) {
progressBar.setVisibility(View.VISIBLE);
bottomLoading = true;
@ -701,7 +696,8 @@ public class TimelineFragment extends SFragment implements
private void fullyRefresh() {
statuses.clear();
updateAdapter();
sendFetchTimelineRequest(null, null, FetchEnd.TOP, -1);
bottomLoading = true;
sendFetchTimelineRequest(null, null, FetchEnd.BOTTOM, -1);
}
private boolean jumpToTopAllowed() {
@ -745,12 +741,6 @@ public class TimelineFragment extends SFragment implements
private void sendFetchTimelineRequest(@Nullable String fromId, @Nullable String uptoId,
final FetchEnd fetchEnd, final int pos) {
/* If there is a fetch already ongoing, record however many fetches are requested and
* fulfill them after it's complete. */
if (fetchEnd == FetchEnd.TOP && topLoading) {
topFetches++;
return;
}
Callback<List<Status>> callback = new Callback<List<Status>>() {
@Override
@ -862,14 +852,6 @@ public class TimelineFragment extends SFragment implements
bottomLoading = false;
break;
}
case TOP: {
topLoading = false;
if (topFetches > 0) {
topFetches--;
onRefresh();
}
break;
}
}
}

Loading…
Cancel
Save