From 0e9eb6649133f57e78e868a0eb5f926c8eec6a4b Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 19 Aug 2022 13:29:38 +0200 Subject: [PATCH] Added menu item to show/hide child folders in the nav menu --- .../java/eu/faircode/email/AdapterFolder.java | 46 ++++++++++++++++++- app/src/main/res/values/strings.xml | 1 + 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterFolder.java b/app/src/main/java/eu/faircode/email/AdapterFolder.java index f25eff01a3..95f9ab21da 100644 --- a/app/src/main/java/eu/faircode/email/AdapterFolder.java +++ b/app/src/main/java/eu/faircode/email/AdapterFolder.java @@ -662,7 +662,9 @@ public class AdapterFolder extends RecyclerView.Adapter() { + @Override + protected Void onExecute(Context context, Bundle args) throws Throwable { + long id = args.getLong("id"); + boolean enabled = args.getBoolean("enabled"); + + DB db = DB.getInstance(context); + try { + db.beginTransaction(); + List childs = db.folder().getChildFolders(id); + if (childs == null) + return null; + + for (EntityFolder child : childs) + db.folder().setFolderNavigation(child.id, enabled); + + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + + return null; + } + + @Override + protected void onException(Bundle args, Throwable ex) { + Log.unexpectedError(parentFragment.getParentFragmentManager(), ex); + } + }.execute(context, owner, args, "enable"); + } + private void onActionSyncMore(boolean children) { Bundle args = new Bundle(); args.putLong("folder", folder.id); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bb42127dc2..afadb4f5aa 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1146,6 +1146,7 @@ Only in the folder list shown on the start screen Show in unified inbox Show in navigation menu + Hide in navigation menu Synchronize (receive messages) Check periodically instead of continuous synchronize Most email servers allow push messages for a handful of folders only!