Skip loading previous/next message

This commit is contained in:
M66B 2020-04-26 09:05:43 +02:00
parent 02c70134fd
commit bd7cae3cff
1 changed files with 0 additions and 9 deletions

View File

@ -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;
}
}