fix placeholder not resetting itself after a load failed
This commit is contained in:
parent
6baa187976
commit
4fa8dcc8be
@ -539,6 +539,18 @@ public class NotificationsFragment extends SFragment implements
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
|
||||
private void onFetchNotificationsFailure(Exception exception, FetchEnd fetchEnd, int position) {
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
if (fetchEnd == FetchEnd.MIDDLE && !notifications.get(position).isRight()) {
|
||||
NotificationViewData placeholderVD =
|
||||
new NotificationViewData.Placeholder(false);
|
||||
notifications.setPairedItem(position, placeholderVD);
|
||||
adapter.updateItemWithNotify(position, placeholderVD, true);
|
||||
}
|
||||
Log.e(TAG, "Fetch failure: " + exception.getMessage());
|
||||
fulfillAnyQueuedFetches(fetchEnd);
|
||||
}
|
||||
|
||||
private void update(@Nullable List<Notification> newNotifications, @Nullable String fromId,
|
||||
@Nullable String uptoId) {
|
||||
if (ListUtils.isEmpty(newNotifications)) {
|
||||
@ -593,19 +605,6 @@ public class NotificationsFragment extends SFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onFetchNotificationsFailure(Exception exception, FetchEnd fetchEnd, int position) {
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
if (fetchEnd == FetchEnd.MIDDLE && !notifications.get(position).isRight()) {
|
||||
NotificationViewData placeholderVD =
|
||||
new NotificationViewData.Placeholder(false);
|
||||
notifications.setPairedItem(position, placeholderVD);
|
||||
adapter.updateItemWithNotify(position, placeholderVD, true);
|
||||
}
|
||||
Log.e(TAG, "Fetch failure: " + exception.getMessage());
|
||||
fulfillAnyQueuedFetches(fetchEnd);
|
||||
}
|
||||
|
||||
private void fulfillAnyQueuedFetches(FetchEnd fetchEnd) {
|
||||
switch (fetchEnd) {
|
||||
case BOTTOM: {
|
||||
|
@ -627,7 +627,7 @@ public class TimelineFragment extends SFragment implements
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
|
||||
if (fetchEnd == FetchEnd.MIDDLE && !statuses.get(position).isRight()) {
|
||||
StatusViewData newViewData = new StatusViewData.Placeholder(true);
|
||||
StatusViewData newViewData = new StatusViewData.Placeholder(false);
|
||||
statuses.setPairedItem(position, newViewData);
|
||||
adapter.changeItem(position, newViewData, true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user