Fixes timelines and notifications tabs fetching progressively further down when they are restarted.
This commit is contained in:
parent
be5af7e1df
commit
96cba0cc2b
3 changed files with 25 additions and 3 deletions
|
@ -134,6 +134,11 @@ public class AccountListFragment extends BaseFragment implements AccountActionLi
|
|||
}
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
bottomLoading = false;
|
||||
bottomFetches = 0;
|
||||
topLoading = false;
|
||||
topFetches = 0;
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,6 +133,13 @@ public class NotificationsFragment extends SFragment implements
|
|||
LocalBroadcastManager.getInstance(context.getApplicationContext())
|
||||
.registerReceiver(timelineReceiver, TimelineReceiver.getFilter(null));
|
||||
|
||||
topLoading = false;
|
||||
topFetches = 0;
|
||||
bottomLoading = false;
|
||||
bottomFetches = 0;
|
||||
bottomId = null;
|
||||
topId = null;
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public class TimelineFragment extends SFragment implements
|
|||
@Nullable
|
||||
private String bottomId;
|
||||
@Nullable
|
||||
private String upToId;
|
||||
private String topId;
|
||||
private PairedList<Status, StatusViewData> statuses =
|
||||
new PairedList<>(ViewDataUtils.statusMapper());
|
||||
|
||||
|
@ -159,6 +159,13 @@ public class TimelineFragment extends SFragment implements
|
|||
LocalBroadcastManager.getInstance(context.getApplicationContext())
|
||||
.registerReceiver(timelineReceiver, TimelineReceiver.getFilter(kind));
|
||||
|
||||
topLoading = false;
|
||||
topFetches = 0;
|
||||
bottomLoading = false;
|
||||
bottomFetches = 0;
|
||||
bottomId = null;
|
||||
topId = null;
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
@ -240,7 +247,7 @@ public class TimelineFragment extends SFragment implements
|
|||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
sendFetchTimelineRequest(null, upToId, FetchEnd.TOP);
|
||||
sendFetchTimelineRequest(null, topId, FetchEnd.TOP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -597,7 +604,7 @@ public class TimelineFragment extends SFragment implements
|
|||
bottomId = fromId;
|
||||
}
|
||||
if (toId != null) {
|
||||
upToId = toId;
|
||||
topId = toId;
|
||||
}
|
||||
if (statuses.isEmpty()) {
|
||||
// This construction removes duplicates while preserving order.
|
||||
|
@ -619,6 +626,9 @@ public class TimelineFragment extends SFragment implements
|
|||
}
|
||||
|
||||
private void addItems(List<Status> newStatuses, @Nullable String fromId) {
|
||||
if (ListUtils.isEmpty(newStatuses)) {
|
||||
return;
|
||||
}
|
||||
int end = statuses.size();
|
||||
Status last = statuses.get(end - 1);
|
||||
if (last != null && !findStatus(newStatuses, last.id)) {
|
||||
|
|
Loading…
Reference in a new issue