From b579a9baea81b9c1e3b350ca1c1dc83081f6fd5e Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Sun, 26 Aug 2018 21:10:38 +0200 Subject: [PATCH] fix notification tab loading bottom notifications forever (#807) --- .../tusky/fragment/NotificationsFragment.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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 d6ece229f..bf0749bf5 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java @@ -207,7 +207,7 @@ public class NotificationsFragment extends SFragment implements ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false); setupNothingView(); - sendFetchNotificationsRequest(null, topId, FetchEnd.TOP, -1); + sendFetchNotificationsRequest(null, topId, FetchEnd.BOTTOM, -1); return rootView; } @@ -551,6 +551,10 @@ public class NotificationsFragment extends SFragment implements } private void onLoadMore() { + if(bottomId == null) { + // already loaded everything + return; + } Either last = notifications.get(notifications.size() - 1); if (last.isRight()) { notifications.add(Either.left(Placeholder.getInstance())); @@ -741,12 +745,10 @@ public class NotificationsFragment extends SFragment implements } private void addItems(List newNotifications, @Nullable String fromId) { + bottomId = fromId; if (ListUtils.isEmpty(newNotifications)) { return; } - if (fromId != null) { - bottomId = fromId; - } int end = notifications.size(); List> liftedNew = liftNotificationList(newNotifications); Either last = notifications.get(end - 1);