From 3f366b00e7d1182719022aeb23b1678ecd1c3e94 Mon Sep 17 00:00:00 2001 From: Distopico Vegan Date: Wed, 7 Nov 2018 20:09:41 -0500 Subject: [PATCH] minor refactor change --- .../org/dystopia/email/FragmentMessages.java | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/org/dystopia/email/FragmentMessages.java b/app/src/main/java/org/dystopia/email/FragmentMessages.java index 30e7dc51..e3abcdb6 100644 --- a/app/src/main/java/org/dystopia/email/FragmentMessages.java +++ b/app/src/main/java/org/dystopia/email/FragmentMessages.java @@ -17,7 +17,7 @@ package org.dystopia.email; along with FairEmail. If not, see . Copyright 2018 by Marcel Bokhorst (M66B) - Copyright 2019 by Distopico + Copyright 2018 by Distopico */ import android.content.Context; @@ -1129,8 +1129,8 @@ public class FragmentMessages extends FragmentEx { for (int i = 0; i < messages.size(); i++) { TupleMessageEx message = messages.get(i); if (!EntityFolder.ARCHIVE.equals(message.folderType) && - !EntityFolder.SENT.equals(message.folderType) && - !EntityFolder.OUTBOX.equals(message.folderType)) { + !EntityFolder.SENT.equals(message.folderType) && + !EntityFolder.OUTBOX.equals(message.folderType)) { autoCount++; single = message; if (!message.ui_seen) { @@ -1146,34 +1146,33 @@ public class FragmentMessages extends FragmentEx { // - sole message TupleMessageEx expand = null; - if (autoCount == 1) + if (autoCount == 1) { expand = single; - else if (unseen == 1) + } else if (unseen == 1) { expand = see; - else if (messages.size() == 1) + } else if (messages.size() == 1) { expand = messages.get(0); - + } if (expand != null) { expanded.add(expand.id); handleExpand(expand.id); } - } else { - if (autoCount > 0) { - int count = 0; - for (int i = 0; i < messages.size(); i++) { - TupleMessageEx message = messages.get(i); - if (!EntityFolder.ARCHIVE.equals(message.folderType) && - !EntityFolder.SENT.equals(message.folderType) && - !EntityFolder.OUTBOX.equals(message.folderType)) { - count++; - } + } else if (autoCount > 0) { + int count = 0; + for (int i = 0; i < messages.size(); i++) { + TupleMessageEx message = messages.get(i); + if (!EntityFolder.ARCHIVE.equals(message.folderType) && + !EntityFolder.SENT.equals(message.folderType) && + !EntityFolder.OUTBOX.equals(message.folderType)) { + count++; } + } - // Auto close when: - // - no more non archived/sent messages + // Auto close when: + // - no more non archived/sent messages - if (count == 0) - finish(); + if (count == 0) { + finish(); } } } else { @@ -1186,13 +1185,15 @@ public class FragmentMessages extends FragmentEx { boolean searching = (searchCallback != null && searchCallback.isSearching()); - if (!searching) + if (!searching) { pbWait.setVisibility(View.GONE); + } grpReady.setVisibility(View.VISIBLE); if (messages.size() == 0) { - if (searchCallback == null) + if (searchCallback == null) { tvNoEmail.setVisibility(View.VISIBLE); + } rvMessage.setVisibility(View.GONE); } else { tvNoEmail.setVisibility(View.GONE);