From 2dfabba5082b502ff0f2ba66fb9335f1d5372e7b Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 16 Apr 2020 16:25:10 +0200 Subject: [PATCH] Added menu to delete non-selectable folders --- .../java/eu/faircode/email/AdapterFolder.java | 20 ++++++++++ .../eu/faircode/email/FragmentFolders.java | 40 +++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/AdapterFolder.java b/app/src/main/java/eu/faircode/email/AdapterFolder.java index 16440ceffe..4b11d98cc2 100644 --- a/app/src/main/java/eu/faircode/email/AdapterFolder.java +++ b/app/src/main/java/eu/faircode/email/AdapterFolder.java @@ -414,6 +414,7 @@ public class AdapterFolder extends RecyclerView.Adapter() { + @Override + protected Void onExecute(Context context, Bundle args) { + long id = args.getLong("id"); + + EntityFolder folder; + + DB db = DB.getInstance(context); + try { + db.beginTransaction(); + + folder = db.folder().getFolder(id); + if (folder == null) + return null; + + db.folder().setFolderTbd(folder.id); + + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + + ServiceSynchronize.reload(context, folder.account, false, "delete folder"); + + return null; + } + + @Override + protected void onException(Bundle args, Throwable ex) { + Log.unexpectedError(getParentFragmentManager(), ex); + } + }.execute(this, args, "folder:delete"); + } + public static class FragmentDialogApply extends FragmentDialogBase { @NonNull @Override