From cdc0cba3f2078670c6b46e5eccf8dc294b41d71d Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 7 May 2021 21:40:14 +0200 Subject: [PATCH] Show permanent delete max --- .../java/eu/faircode/email/FragmentMessages.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index b52e1bd1aa..52a4327c4e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -60,6 +60,8 @@ import android.provider.Settings; import android.security.KeyChain; import android.security.KeyChainException; import android.text.SpannableString; +import android.text.SpannableStringBuilder; +import android.text.Spanned; import android.text.TextUtils; import android.text.format.DateUtils; import android.text.style.ForegroundColorSpan; @@ -2912,9 +2914,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. .setIcon(R.drawable.twotone_delete_24); if (result.isTrash || !result.hasTrash || result.isJunk || - ids.length <= MAX_PERMANENT_DELETE) // is trash or no trash or is junk - popupMenu.getMenu().add(Menu.NONE, R.string.title_delete_permanently, order++, R.string.title_delete_permanently) - .setIcon(R.drawable.twotone_delete_forever_24); + ids.length <= MAX_PERMANENT_DELETE || true) { // is trash or no trash or is junk + SpannableStringBuilder del = new SpannableStringBuilder(); + del.append(getString(R.string.title_delete_permanently)); + int pos = del.length(); + del.append(" (").append(NF.format(MAX_PERMANENT_DELETE)).append("-)"); + del.setSpan(new RelativeSizeSpan(0.7f), pos, del.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + popupMenu.getMenu().add(Menu.NONE, R.string.title_delete_permanently, order++, del) + .setIcon(R.drawable.twotone_delete_forever_24) + .setEnabled(ids.length <= MAX_PERMANENT_DELETE); + } if (result.accounts.size() > 0 /* IMAP */ && ids.length < MAX_SEND_RAW) popupMenu.getMenu().add(Menu.NONE, R.string.title_raw_send, order++, R.string.title_raw_send)