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 boolean filterRemoveRegex;
private Matcher filterRemoveRegexMatcher; private Matcher filterRemoveRegexMatcher;
private boolean hideFab; private boolean hideFab;
private boolean topLoading;
private int topFetches;
private boolean bottomLoading; private boolean bottomLoading;
@Nullable @Nullable
@ -222,12 +220,9 @@ public class TimelineFragment extends SFragment implements
setupTimelinePreferences(); setupTimelinePreferences();
setupNothingView(); setupNothingView();
topLoading = false;
topFetches = 0;
bottomId = null; bottomId = null;
topId = null; topId = null;
if (statuses.isEmpty()) { if (statuses.isEmpty()) {
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
bottomLoading = true; bottomLoading = true;
@ -701,7 +696,8 @@ public class TimelineFragment extends SFragment implements
private void fullyRefresh() { private void fullyRefresh() {
statuses.clear(); statuses.clear();
updateAdapter(); updateAdapter();
sendFetchTimelineRequest(null, null, FetchEnd.TOP, -1); bottomLoading = true;
sendFetchTimelineRequest(null, null, FetchEnd.BOTTOM, -1);
} }
private boolean jumpToTopAllowed() { private boolean jumpToTopAllowed() {
@ -745,12 +741,6 @@ public class TimelineFragment extends SFragment implements
private void sendFetchTimelineRequest(@Nullable String fromId, @Nullable String uptoId, private void sendFetchTimelineRequest(@Nullable String fromId, @Nullable String uptoId,
final FetchEnd fetchEnd, final int pos) { 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>>() { Callback<List<Status>> callback = new Callback<List<Status>>() {
@Override @Override
@ -862,14 +852,6 @@ public class TimelineFragment extends SFragment implements
bottomLoading = false; bottomLoading = false;
break; break;
} }
case TOP: {
topLoading = false;
if (topFetches > 0) {
topFetches--;
onRefresh();
}
break;
}
} }
} }