From b09e4729f6a35db55ea814ec8ae620734cce72ee Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 4 Oct 2019 17:48:02 +0200 Subject: [PATCH] Encryption fixes --- .../main/java/eu/faircode/email/FragmentCompose.java | 12 ++++++++---- ...o_encryption_24.xml => baseline_lock_open_24.xml} | 2 +- .../main/res/layout/include_message_navigation.xml | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) rename app/src/main/res/drawable/{baseline_no_encryption_24.xml => baseline_lock_open_24.xml} (50%) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 1c754b3ede..c7d34402bb 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -928,7 +928,7 @@ public class FragmentCompose extends FragmentBase { menu.findItem(R.id.menu_answer).setEnabled(!busy); menu.findItem(R.id.menu_send).setEnabled(!busy); - menu.findItem(R.id.menu_encrypt).setIcon(encrypt ? R.drawable.baseline_no_encryption_24 : R.drawable.baseline_lock_24); + menu.findItem(R.id.menu_encrypt).setIcon(encrypt ? R.drawable.baseline_lock_open_24 : R.drawable.baseline_lock_24); menu.findItem(R.id.menu_media).setChecked(media); menu.findItem(R.id.menu_compact).setChecked(compact); @@ -3000,8 +3000,12 @@ public class FragmentCompose extends FragmentBase { fragment.setArguments(args); fragment.setTargetFragment(FragmentCompose.this, REQUEST_SEND); fragment.show(getFragmentManager(), "compose:send"); - } else - onAction(R.id.action_send); + } else { + if (encrypt) + onEncrypt(); + else + onAction(R.id.action_send); + } } else if (action == R.id.action_send) { autosave = false; @@ -3506,6 +3510,7 @@ public class FragmentCompose extends FragmentBase { cbNotAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + prefs.edit().putBoolean("send_dialog", !isChecked).apply(); tvNotAgain.setVisibility(isChecked && send_dialog ? View.VISIBLE : View.GONE); } }); @@ -3699,7 +3704,6 @@ public class FragmentCompose extends FragmentBase { @Override public void onClick(DialogInterface dialog, int which) { getArguments().putBoolean("encrypt", cbEncrypt.isChecked()); - prefs.edit().putBoolean("send_dialog", !cbNotAgain.isChecked()).apply(); sendResult(Activity.RESULT_OK); } }) diff --git a/app/src/main/res/drawable/baseline_no_encryption_24.xml b/app/src/main/res/drawable/baseline_lock_open_24.xml similarity index 50% rename from app/src/main/res/drawable/baseline_no_encryption_24.xml rename to app/src/main/res/drawable/baseline_lock_open_24.xml index d1f9e7a514..7ccfd80d50 100644 --- a/app/src/main/res/drawable/baseline_no_encryption_24.xml +++ b/app/src/main/res/drawable/baseline_lock_open_24.xml @@ -6,5 +6,5 @@ android:tint="?attr/colorControlNormal"> + android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6h1.9c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM18,20L6,20L6,10h12v10z"/> diff --git a/app/src/main/res/layout/include_message_navigation.xml b/app/src/main/res/layout/include_message_navigation.xml index 0c4d9c3f49..595de0553f 100644 --- a/app/src/main/res/layout/include_message_navigation.xml +++ b/app/src/main/res/layout/include_message_navigation.xml @@ -30,7 +30,7 @@ android:tooltipText="@string/title_decrypt" app:layout_constraintEnd_toStartOf="@+id/ibUnsubscribe" app:layout_constraintTop_toBottomOf="@id/bnvActions" - app:srcCompat="@drawable/baseline_no_encryption_24" /> + app:srcCompat="@drawable/baseline_lock_open_24" />