From dd888c475ca8de18e24be6b56a8f3f02cd135577 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 31 Jan 2019 13:52:25 +0000 Subject: [PATCH] Revert "Small behavior improvement" This reverts commit a390d525ae55fdbc1a4d8a8e74783ccfa8d1f4d5. --- .../java/eu/faircode/email/FragmentMessages.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 58264c09f1..b61be94394 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -124,9 +124,9 @@ public class FragmentMessages extends FragmentBase { private boolean autonext; private boolean addresses; - private Long primary = null; + private long primary = -1; private boolean outbox = false; - private Boolean connected = null; + private boolean connected = false; private boolean searching = false; private AdapterMessage adapter; private boolean animate = true; @@ -1398,8 +1398,7 @@ public class FragmentMessages extends FragmentBase { public void onChanged(EntityAccount account) { long primary = (account == null ? -1 : account.id); boolean connected = (account != null && "connected".equals(account.state)); - if (FragmentMessages.this.primary == null || FragmentMessages.this.connected == null || - FragmentMessages.this.primary != primary || FragmentMessages.this.connected != connected) { + if (FragmentMessages.this.primary != primary || FragmentMessages.this.connected != connected) { FragmentMessages.this.primary = primary; FragmentMessages.this.connected = connected; getActivity().invalidateOptionsMenu(); @@ -1652,10 +1651,8 @@ public class FragmentMessages extends FragmentBase { menu.findItem(R.id.menu_search).setVisible(viewType != AdapterMessage.ViewType.SEARCH); - menu.findItem(R.id.menu_folders).setVisible(primary == null || primary >= 0); - menu.findItem(R.id.menu_folders).setEnabled(primary != null); - menu.findItem(R.id.menu_folders).setIcon( - connected != null && connected ? R.drawable.baseline_folder_24 : R.drawable.baseline_folder_open_24); + menu.findItem(R.id.menu_folders).setVisible(primary >= 0); + menu.findItem(R.id.menu_folders).setIcon(connected ? R.drawable.baseline_folder_24 : R.drawable.baseline_folder_open_24); menu.findItem(R.id.menu_sort_on).setVisible(!selection && (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER));