diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java
index 9d241358fc..b1ddb82091 100644
--- a/app/src/main/java/eu/faircode/email/FragmentCompose.java
+++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java
@@ -793,6 +793,7 @@ public class FragmentCompose extends FragmentBase {
final DB db = DB.getInstance(getContext());
+ final boolean suggest_names = prefs.getBoolean("suggest_names", true);
final boolean suggest_sent = prefs.getBoolean("suggest_sent", true);
final boolean suggest_received = prefs.getBoolean("suggest_received", false);
final boolean suggest_frequently = prefs.getBoolean("suggest_frequently", false);
@@ -870,7 +871,7 @@ public class FragmentCompose extends FragmentBase {
String name = cursor.getString(colName);
String email = MessageHelper.sanitizeEmail(cursor.getString(colEmail));
StringBuilder sb = new StringBuilder();
- if (name == null)
+ if (name == null || !suggest_names)
sb.append(email);
else {
sb.append("\"").append(name).append("\" ");
@@ -2052,6 +2053,9 @@ public class FragmentCompose extends FragmentBase {
int requestCode = args.getInt("requestCode");
Uri uri = args.getParcelable("uri");
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ boolean suggest_names = prefs.getBoolean("suggest_names", true);
+
EntityMessage draft = null;
DB db = DB.getInstance(context);
@@ -2092,7 +2096,7 @@ public class FragmentCompose extends FragmentBase {
if (address != null)
list.addAll(Arrays.asList(address));
- list.add(new InternetAddress(email, name, StandardCharsets.UTF_8.name()));
+ list.add(new InternetAddress(email, suggest_names ? name : null, StandardCharsets.UTF_8.name()));
if (requestCode == REQUEST_CONTACT_TO)
draft.to = list.toArray(new Address[0]);
diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java
index 842153b480..329f2f6227 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java
@@ -44,6 +44,7 @@ import androidx.preference.PreferenceManager;
public class FragmentOptionsSend extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
private SwitchCompat swKeyboard;
private SwitchCompat swKeyboardNoFullscreen;
+ private SwitchCompat swSuggestNames;
private SwitchCompat swSuggestSent;
private SwitchCompat swSuggestReceived;
private SwitchCompat swSuggestFrequently;
@@ -74,7 +75,8 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private SwitchCompat swLookupMx;
private final static String[] RESET_OPTIONS = new String[]{
- "keyboard", "keyboard_no_fullscreen", "suggest_sent", "suggested_received", "suggest_frequently",
+ "keyboard", "keyboard_no_fullscreen",
+ "suggest_names", "suggest_sent", "suggested_received", "suggest_frequently",
"send_reminders", "send_delayed",
"compose_font", "prefix_once", "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply",
"signature_location", "signature_reply", "signature_forward",
@@ -95,6 +97,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
swKeyboard = view.findViewById(R.id.swKeyboard);
swKeyboardNoFullscreen = view.findViewById(R.id.swKeyboardNoFullscreen);
+ swSuggestNames = view.findViewById(R.id.swSuggestNames);
swSuggestSent = view.findViewById(R.id.swSuggestSent);
swSuggestReceived = view.findViewById(R.id.swSuggestReceived);
swSuggestFrequently = view.findViewById(R.id.swSuggestFrequently);
@@ -144,6 +147,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
});
+ swSuggestNames.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("suggest_names", checked).apply();
+ }
+ });
+
swSuggestSent.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -410,6 +420,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
swKeyboard.setChecked(prefs.getBoolean("keyboard", true));
swKeyboardNoFullscreen.setChecked(prefs.getBoolean("keyboard_no_fullscreen", false));
+ swSuggestNames.setChecked(prefs.getBoolean("suggest_names", true));
swSuggestSent.setChecked(prefs.getBoolean("suggest_sent", true));
swSuggestReceived.setChecked(prefs.getBoolean("suggest_received", false));
swSuggestFrequently.setChecked(prefs.getBoolean("suggest_frequently", false));
diff --git a/app/src/main/res/layout/fragment_options_send.xml b/app/src/main/res/layout/fragment_options_send.xml
index b599ca09c2..c6289aac53 100644
--- a/app/src/main/res/layout/fragment_options_send.xml
+++ b/app/src/main/res/layout/fragment_options_send.xml
@@ -67,6 +67,29 @@
app:layout_constraintTop_toBottomOf="@id/swKeyboard"
app:switchPadding="12dp" />
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@id/tvSuggestNames" />
Show keyboard by default
Prevent fullscreen keyboard
+ Use names and email addresses
Suggest locally stored contacts
Suggest addresses found in sent messages
Suggest addresses found in received messages
@@ -567,6 +568,7 @@
This will check if DNS MX records exist
This will slow down synchronizing messages
+ If disabled, only email addresses will be used
In addition to contacts provided by Android. Contact data will be stored for newly sent or received messages only when enabled.
Insert \'-- \' between the text and the signature
Show a warning when the message text or the subject is empty or when an attachment might be missing