From 52dd9559d6910e04424e6b5d43aa5f70a6ec74a1 Mon Sep 17 00:00:00 2001 From: Conny Duck Date: Tue, 7 Nov 2017 12:59:46 +0100 Subject: [PATCH] fix placeholder not resetting itself after a load failed --- .../tusky/fragment/NotificationsFragment.java | 25 +++++++++---------- .../tusky/fragment/TimelineFragment.java | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java index 9a0be925..583ee0ac 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java @@ -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 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: { diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java index f04d8a5f..9a53c6de 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java @@ -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); }