From 645c738a6b519441e770e3bb49e1ca0c1f0af3c0 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 31 Mar 2021 12:01:18 +0200 Subject: [PATCH] Persistent show hidden folders setting --- app/src/main/java/eu/faircode/email/FragmentFolders.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentFolders.java b/app/src/main/java/eu/faircode/email/FragmentFolders.java index fcbbe29218..3e3b7d689e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentFolders.java +++ b/app/src/main/java/eu/faircode/email/FragmentFolders.java @@ -85,7 +85,7 @@ public class FragmentFolders extends FragmentBase { private boolean imap = false; private boolean primary; private boolean show_hidden = false; - private boolean show_flagged; + private boolean show_flagged = false; private AdapterFolder adapter; private NumberFormat NF = NumberFormat.getNumberInstance(); @@ -107,6 +107,7 @@ public class FragmentFolders extends FragmentBase { cards = prefs.getBoolean("cards", true); beige = prefs.getBoolean("beige", true); compact = prefs.getBoolean("compact_folders", false); + show_hidden = prefs.getBoolean("hidden_folders", false); show_flagged = prefs.getBoolean("flagged_folders", false); setTitle(R.string.page_folders); @@ -517,6 +518,10 @@ public class FragmentFolders extends FragmentBase { private void onMenuShowHidden() { show_hidden = !show_hidden; + + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + prefs.edit().putBoolean("hidden_folders", show_hidden).apply(); + getActivity().invalidateOptionsMenu(); adapter.setShowHidden(show_hidden); }