fix crash on timeline reloading

This commit is contained in:
Conny Duck 2018-06-25 18:20:45 +02:00
parent b655985997
commit 77617ba9bf
1 changed files with 2 additions and 20 deletions

View File

@ -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;
}
}
}