Skipped trashed messages for auto expand/close

This commit is contained in:
M66B 2018-11-16 20:52:15 +01:00
parent 36e53aa2b0
commit 68f4fe2e46
1 changed files with 8 additions and 4 deletions

View File

@ -1203,6 +1203,7 @@ public class FragmentMessages extends FragmentEx {
TupleMessageEx see = null; TupleMessageEx see = null;
for (TupleMessageEx message : messages) for (TupleMessageEx message : messages)
if (!EntityFolder.ARCHIVE.equals(message.folderType) && if (!EntityFolder.ARCHIVE.equals(message.folderType) &&
!EntityFolder.TRASH.equals(message.folderType) &&
!EntityFolder.isOutgoing(message.folderType)) { !EntityFolder.isOutgoing(message.folderType)) {
autoCount++; autoCount++;
single = message; single = message;
@ -1211,10 +1212,11 @@ public class FragmentMessages extends FragmentEx {
see = message; see = message;
} }
} }
Log.i(Helper.TAG, "Auto count=" + autoCount);
// Auto expand when: // Auto expand when:
// - single, non archived/sent message // - single, non archived/trashed/outgoing message
// - one unread, non archived/sent message in conversation // - one unread, non archived/trashed/outgoing message in conversation
// - sole message // - sole message
TupleMessageEx expand = null; TupleMessageEx expand = null;
@ -1230,17 +1232,19 @@ public class FragmentMessages extends FragmentEx {
handleExpand(expand.id); handleExpand(expand.id);
} }
} else { } else {
if (autoCount > 0 && navigation) { if (autoCount > 0 && !navigation) {
int count = 0; int count = 0;
for (int i = 0; i < messages.size(); i++) { for (int i = 0; i < messages.size(); i++) {
TupleMessageEx message = messages.get(i); TupleMessageEx message = messages.get(i);
if (!EntityFolder.ARCHIVE.equals(message.folderType) && if (!EntityFolder.ARCHIVE.equals(message.folderType) &&
!EntityFolder.TRASH.equals(message.folderType) &&
!EntityFolder.isOutgoing(message.folderType)) !EntityFolder.isOutgoing(message.folderType))
count++; count++;
} }
Log.i(Helper.TAG, "Auto close=" + count);
// Auto close when: // Auto close when:
// - no more non archived/sent messages // - no more non archived/trashed/outgoing messages
if (count == 0) if (count == 0)
finish(); finish();