From 13ed88673910c2bcbbf71701811afdd709295851 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 30 Sep 2018 10:24:13 +0000 Subject: [PATCH] Show if primary account is connected --- .../main/java/eu/faircode/email/FragmentMessages.java | 3 +++ app/src/main/res/drawable/baseline_folder_open_24.xml | 10 ++++++++++ app/src/main/res/menu/menu_list.xml | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/baseline_folder_open_24.xml diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index f21334c2..275f6f8f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -80,6 +80,7 @@ public class FragmentMessages extends FragmentEx { private String search = null; private long primary = -1; + private boolean connected = false; private AdapterMessage adapter; private AdapterMessage.ViewType viewType; @@ -400,6 +401,7 @@ public class FragmentMessages extends FragmentEx { @Override public void onChanged(EntityAccount account) { primary = (account == null ? -1 : account.id); + connected = (account != null && "connected".equals(account.state)); getActivity().invalidateOptionsMenu(); } }); @@ -587,6 +589,7 @@ public class FragmentMessages extends FragmentEx { menu.findItem(R.id.menu_search).setVisible(folder >= 0 && search == null); menu.findItem(R.id.menu_sort_on).setVisible(TextUtils.isEmpty(search)); 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); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); String sort = prefs.getString("sort", "time"); diff --git a/app/src/main/res/drawable/baseline_folder_open_24.xml b/app/src/main/res/drawable/baseline_folder_open_24.xml new file mode 100644 index 00000000..42660cac --- /dev/null +++ b/app/src/main/res/drawable/baseline_folder_open_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/menu/menu_list.xml b/app/src/main/res/menu/menu_list.xml index 57a11e42..bb42025d 100644 --- a/app/src/main/res/menu/menu_list.xml +++ b/app/src/main/res/menu/menu_list.xml @@ -31,7 +31,7 @@