From 68f4fe2e46132121eee8320f7189ab07f7e6065a Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 16 Nov 2018 20:52:15 +0100 Subject: [PATCH] Skipped trashed messages for auto expand/close --- .../java/eu/faircode/email/FragmentMessages.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index b613963e54..6093aad78e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -1203,6 +1203,7 @@ public class FragmentMessages extends FragmentEx { TupleMessageEx see = null; for (TupleMessageEx message : messages) if (!EntityFolder.ARCHIVE.equals(message.folderType) && + !EntityFolder.TRASH.equals(message.folderType) && !EntityFolder.isOutgoing(message.folderType)) { autoCount++; single = message; @@ -1211,10 +1212,11 @@ public class FragmentMessages extends FragmentEx { see = message; } } + Log.i(Helper.TAG, "Auto count=" + autoCount); // Auto expand when: - // - single, non archived/sent message - // - one unread, non archived/sent message in conversation + // - single, non archived/trashed/outgoing message + // - one unread, non archived/trashed/outgoing message in conversation // - sole message TupleMessageEx expand = null; @@ -1230,17 +1232,19 @@ public class FragmentMessages extends FragmentEx { handleExpand(expand.id); } } else { - if (autoCount > 0 && navigation) { + if (autoCount > 0 && !navigation) { int count = 0; for (int i = 0; i < messages.size(); i++) { TupleMessageEx message = messages.get(i); if (!EntityFolder.ARCHIVE.equals(message.folderType) && + !EntityFolder.TRASH.equals(message.folderType) && !EntityFolder.isOutgoing(message.folderType)) count++; } + Log.i(Helper.TAG, "Auto close=" + count); // Auto close when: - // - no more non archived/sent messages + // - no more non archived/trashed/outgoing messages if (count == 0) finish();