From 0f9371f9ed811fff531b3d56188ce846218ea723 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 26 Jan 2019 11:56:23 +0000 Subject: [PATCH] Load around selected item --- .../main/java/eu/faircode/email/ViewModelMessages.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ViewModelMessages.java b/app/src/main/java/eu/faircode/email/ViewModelMessages.java index f4859f174e..06771f048c 100644 --- a/app/src/main/java/eu/faircode/email/ViewModelMessages.java +++ b/app/src/main/java/eu/faircode/email/ViewModelMessages.java @@ -95,14 +95,17 @@ public class ViewModelMessages extends ViewModel { continue; if (found) { prev = item; - list.getValue().loadAround(i); break; } - if (thread.equals(item.thread)) + if (thread.equals(item.thread)) { found = true; - else + list.getValue().loadAround(i); + } else next = item; } + if (!found) + return new Target[]{null, null}; + return new Target[]{ prev == null ? null : new Target(prev.account, prev.thread, prev.id, prev.ui_found), next == null ? null : new Target(next.account, next.thread, next.id, next.ui_found)};