Removed double confirm permanent delete

pull/194/merge
M66B 3 years ago
parent 850a120cd5
commit fb8585a3de

@ -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() {

@ -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);

@ -55,18 +55,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/barrier" />
<CheckBox
android:id="@+id/cbConfirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/title_no_undo"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvRemark" />
<CheckBox
android:id="@+id/cbNotAgain"
android:layout_width="wrap_content"
@ -75,17 +63,17 @@
android:text="@string/title_no_ask_again"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbConfirm" />
app:layout_constraintTop_toBottomOf="@id/tvRemark" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvAccept"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="Irreversible"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:text="@string/title_ask_delete_accept"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
android:textStyle="bold"
android:textStyle="bold|italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbNotAgain" />

@ -1128,7 +1128,6 @@
<string name="title_move_to_account">Move to %1$s &#8230;</string>
<string name="title_report_spam">Treat as spam</string>
<string name="title_delete_permanently">Delete permanently</string>
<string name="title_no_undo">I understand this cannot be undone</string>
<string name="title_snooze">Snooze &#8230;</string>
<string name="title_archive">Archive</string>
<string name="title_reply">Reply</string>

Loading…
Cancel
Save