From fb8585a3de7a77260b451689b4889d0c32e226f0 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 7 Jan 2022 19:20:42 +0100 Subject: [PATCH] Removed double confirm permanent delete --- .../eu/faircode/email/FragmentDialogAsk.java | 20 +++++-------------- .../eu/faircode/email/FragmentMessages.java | 7 ++----- app/src/main/res/layout/dialog_ask_again.xml | 20 ++++--------------- app/src/main/res/values/strings.xml | 1 - 4 files changed, 11 insertions(+), 37 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogAsk.java b/app/src/main/java/eu/faircode/email/FragmentDialogAsk.java index 3fb9070b32..562973ad2d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogAsk.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogAsk.java @@ -46,7 +46,6 @@ public class FragmentDialogAsk extends FragmentDialogBase { Bundle args = getArguments(); String question = args.getString("question"); String remark = args.getString("remark"); - String confirm = args.getString("confirm"); String notagain = args.getString("notagain"); String accept = args.getString("accept"); boolean warning = args.getBoolean("warning"); @@ -60,7 +59,6 @@ public class FragmentDialogAsk extends FragmentDialogBase { View dview = LayoutInflater.from(context).inflate(R.layout.dialog_ask_again, null); TextView tvMessage = dview.findViewById(R.id.tvMessage); TextView tvRemark = dview.findViewById(R.id.tvRemark); - CheckBox cbConfirm = dview.findViewById(R.id.cbConfirm); CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain); TextView tvAccept = dview.findViewById(R.id.tvAccept); ImageButton ibInfo = dview.findViewById(R.id.ibInfo); @@ -68,11 +66,9 @@ public class FragmentDialogAsk extends FragmentDialogBase { tvMessage.setText(question); tvRemark.setText(remark); tvRemark.setVisibility(remark == null ? View.GONE : View.VISIBLE); - cbConfirm.setText(confirm); - cbConfirm.setVisibility(confirm == null ? View.GONE : View.VISIBLE); cbNotAgain.setVisibility(notagain == null ? View.GONE : View.VISIBLE); tvAccept.setText(accept); - tvAccept.setVisibility(View.GONE); + tvAccept.setVisibility(notagain == null && accept != null ? View.VISIBLE : View.GONE); ibInfo.setVisibility(faq == 0 ? View.GONE : View.VISIBLE); if (warning) { @@ -87,8 +83,6 @@ public class FragmentDialogAsk extends FragmentDialogBase { cbNotAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - if (accept == null) - prefs.edit().putBoolean(notagain, isChecked).apply(); tvAccept.setVisibility(isChecked && accept != null ? View.VISIBLE : View.GONE); } }); @@ -108,14 +102,10 @@ public class FragmentDialogAsk extends FragmentDialogBase { .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - boolean confirmed = (confirm == null || cbConfirm.isChecked()); - EntityLog.log(context, "Ask confirmed=" + confirmed); - if (confirmed) { - if (notagain != null && accept != null) - prefs.edit().putBoolean(notagain, cbNotAgain.isChecked()).apply(); - sendResult(Activity.RESULT_OK); - } else - sendResult(Activity.RESULT_CANCELED); + EntityLog.log(context, "Ask confirmed"); + if (notagain != null) + prefs.edit().putBoolean(notagain, cbNotAgain.isChecked()).apply(); + sendResult(Activity.RESULT_OK); } }) .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 2d54df1a09..6b3387e928 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -3748,10 +3748,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. Bundle aargs = new Bundle(); aargs.putString("question", getResources() .getQuantityString(R.plurals.title_deleting_messages, ids.size(), ids.size())); - boolean remark = (popOnly || - EntityFolder.TRASH.equals(type) || - EntityFolder.JUNK.equals(type)); - aargs.putString(remark ? "remark" : "confirm", getString(R.string.title_no_undo)); + aargs.putString("accept", getString(R.string.title_ask_delete_accept)); aargs.putInt("faq", 160); aargs.putLongArray("ids", Helper.toLongArray(ids)); aargs.putBoolean("warning", true); @@ -4052,7 +4049,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. Bundle aargs = new Bundle(); aargs.putString("question", getResources() .getQuantityString(R.plurals.title_deleting_messages, ids.size(), ids.size())); - aargs.putString("remark", getString(R.string.title_no_undo)); + aargs.putString("accept", getString(R.string.title_ask_delete_accept)); aargs.putInt("faq", 160); aargs.putLongArray("ids", Helper.toLongArray(ids)); aargs.putBoolean("warning", true); diff --git a/app/src/main/res/layout/dialog_ask_again.xml b/app/src/main/res/layout/dialog_ask_again.xml index 8b31e9e216..e751819887 100644 --- a/app/src/main/res/layout/dialog_ask_again.xml +++ b/app/src/main/res/layout/dialog_ask_again.xml @@ -55,18 +55,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/barrier" /> - - + app:layout_constraintTop_toBottomOf="@id/tvRemark" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f094efec34..0c22085855 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1128,7 +1128,6 @@ Move to %1$s … Treat as spam Delete permanently - I understand this cannot be undone Snooze … Archive Reply