fix notification tab loading bottom notifications forever (#807)
This commit is contained in:
parent
1d28f4728f
commit
b579a9baea
1 changed files with 6 additions and 4 deletions
|
@ -207,7 +207,7 @@ public class NotificationsFragment extends SFragment implements
|
||||||
((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
|
((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
|
||||||
setupNothingView();
|
setupNothingView();
|
||||||
|
|
||||||
sendFetchNotificationsRequest(null, topId, FetchEnd.TOP, -1);
|
sendFetchNotificationsRequest(null, topId, FetchEnd.BOTTOM, -1);
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
@ -551,6 +551,10 @@ public class NotificationsFragment extends SFragment implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onLoadMore() {
|
private void onLoadMore() {
|
||||||
|
if(bottomId == null) {
|
||||||
|
// already loaded everything
|
||||||
|
return;
|
||||||
|
}
|
||||||
Either<Placeholder, Notification> last = notifications.get(notifications.size() - 1);
|
Either<Placeholder, Notification> last = notifications.get(notifications.size() - 1);
|
||||||
if (last.isRight()) {
|
if (last.isRight()) {
|
||||||
notifications.add(Either.left(Placeholder.getInstance()));
|
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) {
|
private void addItems(List<Notification> newNotifications, @Nullable String fromId) {
|
||||||
|
bottomId = fromId;
|
||||||
if (ListUtils.isEmpty(newNotifications)) {
|
if (ListUtils.isEmpty(newNotifications)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fromId != null) {
|
|
||||||
bottomId = fromId;
|
|
||||||
}
|
|
||||||
int end = notifications.size();
|
int end = notifications.size();
|
||||||
List<Either<Placeholder, Notification>> liftedNew = liftNotificationList(newNotifications);
|
List<Either<Placeholder, Notification>> liftedNew = liftNotificationList(newNotifications);
|
||||||
Either<Placeholder, Notification> last = notifications.get(end - 1);
|
Either<Placeholder, Notification> last = notifications.get(end - 1);
|
||||||
|
|
Loading…
Reference in a new issue