Browse Source

Fixed commas in email addresses

main
M66B 6 years ago
parent
commit
a2ab19206c
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      app/src/main/java/eu/faircode/email/FragmentCompose.java

+ 11
- 4
app/src/main/java/eu/faircode/email/FragmentCompose.java View File

@ -322,7 +322,16 @@ public class FragmentCompose extends FragmentEx {
public CharSequence convertToString(Cursor cursor) {
int colName = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
int colEmail = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA);
return cursor.getString(colName) + " <" + cursor.getString(colEmail) + ">";
String name = cursor.getString(colName);
String email = cursor.getString(colEmail);
StringBuilder sb = new StringBuilder();
if (name == null)
sb.append(email);
else {
sb.append(name.replace(",", "")).append(" ");
sb.append("<").append(email).append(">");
}
return sb.toString();
}
});
}
@ -559,9 +568,7 @@ public class FragmentCompose extends FragmentEx {
InternetAddress address = new InternetAddress(email, name);
StringBuilder sb = new StringBuilder(text);
if (sb.length() > 0)
sb.append(", ");
sb.append(address.toString());
sb.append(address.toString().replace(",", "")).append(", ");
if (requestCode == ActivityCompose.REQUEST_CONTACT_TO)
etTo.setText(sb.toString());


Loading…
Cancel
Save