Fallback on prev/next not loaded

pull/200/head
M66B 3 years ago
parent 03f4972cdd
commit 2775af4837

@ -279,6 +279,8 @@ public class ViewModelMessages extends ViewModel {
if (pos - 1 >= 0) { if (pos - 1 >= 0) {
TupleMessageEx next = messages.get(pos - 1); TupleMessageEx next = messages.get(pos - 1);
if (next == null)
fallback = false;
Log.i("Observe previous/next found id=" + id + " next=" + (next == null ? null : next.id)); Log.i("Observe previous/next found id=" + id + " next=" + (next == null ? null : next.id));
intf.onNext(true, next == null ? null : next.id); intf.onNext(true, next == null ? null : next.id);
} else } else
@ -286,6 +288,8 @@ public class ViewModelMessages extends ViewModel {
if (pos + 1 < messages.size()) { if (pos + 1 < messages.size()) {
TupleMessageEx prev = messages.get(pos + 1); TupleMessageEx prev = messages.get(pos + 1);
if (prev == null)
fallback = false;
Log.i("Observe previous/next found id=" + id + " prev=" + (prev == null ? null : prev.id)); Log.i("Observe previous/next found id=" + id + " prev=" + (prev == null ? null : prev.id));
intf.onPrevious(true, prev == null ? null : prev.id); intf.onPrevious(true, prev == null ? null : prev.id);
} else } else
@ -293,7 +297,8 @@ public class ViewModelMessages extends ViewModel {
intf.onFound(pos, messages.size()); intf.onFound(pos, messages.size());
return; if (fallback)
return;
} }
} }

Loading…
Cancel
Save