From 5e6692f972212b4f024a19f7bf7e5589b8317dab Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 29 Nov 2018 17:18:37 +0100 Subject: [PATCH] Move single messages in single message mode --- app/src/main/java/eu/faircode/email/DaoMessage.java | 3 ++- app/src/main/java/eu/faircode/email/FragmentMessages.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/DaoMessage.java b/app/src/main/java/eu/faircode/email/DaoMessage.java index 78e9723989..a10d3d86f7 100644 --- a/app/src/main/java/eu/faircode/email/DaoMessage.java +++ b/app/src/main/java/eu/faircode/email/DaoMessage.java @@ -163,8 +163,9 @@ public interface DaoMessage { " FROM message" + " WHERE account = :account" + " AND thread = :thread" + + " AND (:id IS NULL OR message.id = :id)" + " AND ui_found = :found") - List getMessageByThread(long account, String thread, boolean found); + List getMessageByThread(long account, String thread, Long id, boolean found); @Query("SELECT message.* FROM message" + " JOIN folder ON folder.id = message.folder" + diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index a519f146e3..1a7b59f830 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -486,7 +486,7 @@ public class FragmentMessages extends FragmentEx { if (thread) { List messages = db.message().getMessageByThread( - message.account, message.thread, message.ui_found); + message.account, message.thread, threading ? null : id, message.ui_found); for (EntityMessage threaded : messages) { if (!threaded.ui_hide && threaded.folder.equals(message.folder)) result.ids.add(threaded.id); @@ -751,7 +751,7 @@ public class FragmentMessages extends FragmentEx { for (long id : ids) { EntityMessage message = db.message().getMessage(id); List messages = db.message().getMessageByThread( - message.account, message.thread, message.ui_found); + message.account, message.thread, threading ? null : id, message.ui_found); for (EntityMessage threaded : messages) if (threaded.folder.equals(message.folder)) { result.ids.add(threaded.id); @@ -1469,7 +1469,7 @@ public class FragmentMessages extends FragmentEx { result.target = db.folder().getFolderByType(account, folderType); - List messages = db.message().getMessageByThread(account, thread, found); + List messages = db.message().getMessageByThread(account, thread, threading ? null : id, found); for (EntityMessage message : messages) if (message.uid != null && !result.target.id.equals(message.folder)) { result.ids.add(message.id);