diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 32deb04b8a..e3abcdca3e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -1293,10 +1293,14 @@ public class FragmentCompose extends FragmentBase { protected Long onExecute(Context context, Bundle args) throws Throwable { String email = args.getString("email"); - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + boolean auto_identity = prefs.getBoolean("auto_identity", true); boolean suggest_sent = prefs.getBoolean("suggest_sent", true); boolean suggest_received = prefs.getBoolean("suggest_received", false); + if (!auto_identity) + return null; + List types = new ArrayList<>(); if (suggest_sent) types.add(EntityContact.TYPE_TO); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java index 80f1877205..a5f9509fcc 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java @@ -62,6 +62,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc private SwitchCompat swSuggestFrequently; private Button btnLocalContacts; private Button btnBlockedSenders; + private SwitchCompat swAutoIdentity; private SwitchCompat swPrefixOnce; private SwitchCompat swPrefixCount; private RadioGroup rgRe; @@ -102,7 +103,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc private final static String[] RESET_OPTIONS = new String[]{ "keyboard", "keyboard_no_fullscreen", - "suggest_names", "suggest_sent", "suggested_received", "suggest_frequently", + "suggest_names", "suggest_sent", "suggested_received", "suggest_frequently", "auto_identity", "alt_re", "alt_fwd", "send_reminders", "send_chips", "send_delayed", "attach_new", "answer_action", "send_pending", "sound_sent", @@ -131,6 +132,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc swSuggestFrequently = view.findViewById(R.id.swSuggestFrequently); btnLocalContacts = view.findViewById(R.id.btnLocalContacts); btnBlockedSenders = view.findViewById(R.id.btnBlockedSenders); + swAutoIdentity = view.findViewById(R.id.swAutoIdentity); swPrefixOnce = view.findViewById(R.id.swPrefixOnce); swPrefixCount = view.findViewById(R.id.swPrefixCount); rgRe = view.findViewById(R.id.rgRe); @@ -252,6 +254,14 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc } }); + swAutoIdentity.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("auto_identity", checked).apply(); + swPrefixCount.setEnabled(checked); + } + }); + swPrefixOnce.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -607,6 +617,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc swSuggestReceived.setChecked(prefs.getBoolean("suggest_received", false)); swSuggestFrequently.setChecked(prefs.getBoolean("suggest_frequently", false)); swSuggestFrequently.setEnabled(swSuggestSent.isChecked() || swSuggestReceived.isChecked()); + swAutoIdentity.setChecked(prefs.getBoolean("auto_identity", true)); swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", true)); swPrefixCount.setChecked(prefs.getBoolean("prefix_count", false)); diff --git a/app/src/main/res/layout/fragment_options_send.xml b/app/src/main/res/layout/fragment_options_send.xml index 964c69c244..39258d1b36 100644 --- a/app/src/main/res/layout/fragment_options_send.xml +++ b/app/src/main/res/layout/fragment_options_send.xml @@ -196,6 +196,30 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/btnLocalContacts" /> + + + + Show non-obtrusive send delayed icon Default font + Automatically select identities for new messages Prefix subject only once on replying or forwarding Add count to reply prefix Insert a horizontal line before a reply/forward header @@ -787,6 +788,7 @@ If disabled, only email addresses will be used when selecting contacts In addition to contacts provided by Android. Contact data will be stored for newly sent or received messages only when enabled. + This will select the last identity used for the first recipient of new messages Show a warning when the message text or the subject is empty or when an attachment might be missing The email server could still add the messages to the sent message folder Insert \'-- \' between the text and the signature