|
|
@ -100,7 +100,7 @@ public class TimelineFragment extends SFragment implements |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private String bottomId; |
|
|
|
private String bottomId; |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private String upToId; |
|
|
|
private String topId; |
|
|
|
private PairedList<Status, StatusViewData> statuses = |
|
|
|
private PairedList<Status, StatusViewData> statuses = |
|
|
|
new PairedList<>(ViewDataUtils.statusMapper()); |
|
|
|
new PairedList<>(ViewDataUtils.statusMapper()); |
|
|
|
|
|
|
|
|
|
|
@ -159,6 +159,13 @@ public class TimelineFragment extends SFragment implements |
|
|
|
LocalBroadcastManager.getInstance(context.getApplicationContext()) |
|
|
|
LocalBroadcastManager.getInstance(context.getApplicationContext()) |
|
|
|
.registerReceiver(timelineReceiver, TimelineReceiver.getFilter(kind)); |
|
|
|
.registerReceiver(timelineReceiver, TimelineReceiver.getFilter(kind)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
topLoading = false; |
|
|
|
|
|
|
|
topFetches = 0; |
|
|
|
|
|
|
|
bottomLoading = false; |
|
|
|
|
|
|
|
bottomFetches = 0; |
|
|
|
|
|
|
|
bottomId = null; |
|
|
|
|
|
|
|
topId = null; |
|
|
|
|
|
|
|
|
|
|
|
return rootView; |
|
|
|
return rootView; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -240,7 +247,7 @@ public class TimelineFragment extends SFragment implements |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onRefresh() { |
|
|
|
public void onRefresh() { |
|
|
|
sendFetchTimelineRequest(null, upToId, FetchEnd.TOP); |
|
|
|
sendFetchTimelineRequest(null, topId, FetchEnd.TOP); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -597,7 +604,7 @@ public class TimelineFragment extends SFragment implements |
|
|
|
bottomId = fromId; |
|
|
|
bottomId = fromId; |
|
|
|
} |
|
|
|
} |
|
|
|
if (toId != null) { |
|
|
|
if (toId != null) { |
|
|
|
upToId = toId; |
|
|
|
topId = toId; |
|
|
|
} |
|
|
|
} |
|
|
|
if (statuses.isEmpty()) { |
|
|
|
if (statuses.isEmpty()) { |
|
|
|
// This construction removes duplicates while preserving order.
|
|
|
|
// 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) { |
|
|
|
private void addItems(List<Status> newStatuses, @Nullable String fromId) { |
|
|
|
|
|
|
|
if (ListUtils.isEmpty(newStatuses)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
int end = statuses.size(); |
|
|
|
int end = statuses.size(); |
|
|
|
Status last = statuses.get(end - 1); |
|
|
|
Status last = statuses.get(end - 1); |
|
|
|
if (last != null && !findStatus(newStatuses, last.id)) { |
|
|
|
if (last != null && !findStatus(newStatuses, last.id)) { |
|
|
|