Skip loading previous/next message

pull/178/head
M66B 5 years ago
parent 02c70134fd
commit bd7cae3cff

@ -263,29 +263,20 @@ public class ViewModelMessages extends ViewModel {
for (int pos = 0; pos < messages.size(); pos++) {
TupleMessageEx item = messages.get(pos);
if (item != null && id == item.id) {
boolean load = false;
if (pos - 1 >= 0) {
TupleMessageEx next = messages.get(pos - 1);
if (next == null)
load = true;
intf.onNext(true, next == null ? null : next.id);
} else
intf.onNext(false, null);
if (pos + 1 < messages.size()) {
TupleMessageEx prev = messages.get(pos + 1);
if (prev == null)
load = true;
intf.onPrevious(true, prev == null ? null : prev.id);
} else
intf.onPrevious(false, null);
intf.onFound(pos, messages.size());
if (load)
messages.loadAround(pos);
return;
}
}

Loading…
Cancel
Save