From c0cc0526ac2350cf6dea0fe7f4ae6a799789f5b4 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 12 Sep 2019 23:25:31 +0200 Subject: [PATCH] Allow enabling send dialog again --- .../java/eu/faircode/email/FragmentCompose.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 5db374670b..77a8e637f1 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -1092,8 +1092,6 @@ public class FragmentCompose extends FragmentBase { private void onActionCheck(boolean dialog) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); - if (dialog) - prefs.edit().remove("send_dialog").apply(); boolean send_dialog = prefs.getBoolean("send_dialog", true); Bundle extras = new Bundle(); @@ -3594,8 +3592,11 @@ public class FragmentCompose extends FragmentBase { @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { long id = getArguments().getLong("id"); - boolean remind_subject = getArguments().getBoolean("remind_subject", false); - boolean remind_attachment = getArguments().getBoolean("remind_attachment", false); + + Bundle args = getArguments(); + boolean dialog = args.getBundle("extras").getBoolean("dialog"); + boolean remind_subject = args.getBoolean("remind_subject", false); + boolean remind_attachment = args.getBoolean("remind_attachment", false); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); int send_delayed = prefs.getInt("send_delayed", 0); @@ -3620,7 +3621,8 @@ public class FragmentCompose extends FragmentBase { tvSendAt.setText(null); tvRemindSubject.setVisibility(remind_subject ? View.VISIBLE : View.GONE); tvRemindAttachment.setVisibility(remind_attachment ? View.VISIBLE : View.GONE); - cbNotAgain.setVisibility(send_dialog ? View.VISIBLE : View.GONE); + cbNotAgain.setChecked(!send_dialog); + cbNotAgain.setVisibility(dialog ? View.VISIBLE : View.GONE); DB db = DB.getInstance(getContext()); db.message().liveMessage(id).observe(getViewLifecycleOwner(), new Observer() { @@ -3725,8 +3727,7 @@ public class FragmentCompose extends FragmentBase { @Override public void onClick(DialogInterface dialog, int which) { getArguments().putBoolean("encrypt", cbEncrypt.isChecked()); - if (cbNotAgain.isChecked()) - prefs.edit().putBoolean("send_dialog", false).apply(); + prefs.edit().putBoolean("send_dialog", !cbNotAgain.isChecked()).apply(); sendResult(Activity.RESULT_OK); } })