From 9498813e73bb4ab77e0f0761f9b8837fe9c624d5 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 5 Apr 2021 15:05:24 +0200 Subject: [PATCH] Added archive auto delete hint --- .../main/java/eu/faircode/email/FragmentFolder.java | 8 +++++++- app/src/main/res/layout/fragment_folder.xml | 13 ++++++++++++- app/src/main/res/values/strings.xml | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentFolder.java b/app/src/main/java/eu/faircode/email/FragmentFolder.java index b6c3e26209..f1223f65ad 100644 --- a/app/src/main/java/eu/faircode/email/FragmentFolder.java +++ b/app/src/main/java/eu/faircode/email/FragmentFolder.java @@ -76,6 +76,7 @@ public class FragmentFolder extends FragmentBase { private EditText etKeepDays; private CheckBox cbKeepAll; private CheckBox cbAutoDelete; + private TextView tvAutoDeleteArchiveHint; private Button btnSave; private ContentLoadingProgressBar pbSave; private TextView tvInboxRootHint; @@ -140,6 +141,7 @@ public class FragmentFolder extends FragmentBase { etKeepDays = view.findViewById(R.id.etKeepDays); cbKeepAll = view.findViewById(R.id.cbKeepAll); cbAutoDelete = view.findViewById(R.id.cbAutoDelete); + tvAutoDeleteArchiveHint = view.findViewById(R.id.tvAutoDeleteArchiveHint); btnSave = view.findViewById(R.id.btnSave); pbSave = view.findViewById(R.id.pbSave); tvInboxRootHint = view.findViewById(R.id.tvInboxRootHint); @@ -245,6 +247,7 @@ public class FragmentFolder extends FragmentBase { cbAutoClassifySource.setVisibility(View.GONE); cbAutoClassifyTarget.setVisibility(View.GONE); tvAutoClassifyPro.setVisibility(View.GONE); + tvAutoDeleteArchiveHint.setVisibility(View.GONE); grpAutoDelete.setVisibility(View.GONE); btnSave.setEnabled(false); pbSave.setVisibility(View.GONE); @@ -322,6 +325,8 @@ public class FragmentFolder extends FragmentBase { Helper.setViewsEnabled(view, true); boolean canAutoClassify = (imap && MessageClassifier.isEnabled(getContext())); + boolean canAutoDelete = (imap && (folder == null || !folder.read_only)); + boolean isArchive = (folder != null && EntityFolder.ARCHIVE.equals(folder.type)); boolean pro = (ActivityBilling.isPro(getContext()) || (folder != null && EntityFolder.JUNK.equals(folder.type))); @@ -340,7 +345,8 @@ public class FragmentFolder extends FragmentBase { cbAutoDelete.setEnabled(!cbKeepAll.isChecked()); cbAutoDelete.setText(folder != null && EntityFolder.TRASH.equals(folder.type) ? R.string.title_auto_delete : R.string.title_auto_trash); - grpAutoDelete.setVisibility(!imap || (folder != null && folder.read_only) ? View.GONE : View.VISIBLE); + grpAutoDelete.setVisibility(canAutoDelete ? View.VISIBLE : View.GONE); + tvAutoDeleteArchiveHint.setVisibility(canAutoDelete && isArchive ? View.VISIBLE : View.GONE); btnSave.setEnabled(true); tvInboxRootHint.setVisibility(folder == null && parent == null ? View.VISIBLE : View.GONE); diff --git a/app/src/main/res/layout/fragment_folder.xml b/app/src/main/res/layout/fragment_folder.xml index e62ae0e926..c678db0af0 100644 --- a/app/src/main/res/layout/fragment_folder.xml +++ b/app/src/main/res/layout/fragment_folder.xml @@ -346,6 +346,17 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/cbAutoDelete" /> + +