fix notification tab loading bottom notifications forever (#807)

main
Konrad Pozniak 6 years ago committed by GitHub
parent 937436091b
commit 1f972debff
  1. 10
      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<Placeholder, Notification> 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<Notification> newNotifications, @Nullable String fromId) {
bottomId = fromId;
if (ListUtils.isEmpty(newNotifications)) {
return;
}
if (fromId != null) {
bottomId = fromId;
}
int end = notifications.size();
List<Either<Placeholder, Notification>> liftedNew = liftNotificationList(newNotifications);
Either<Placeholder, Notification> last = notifications.get(end - 1);

Loading…
Cancel
Save