Browse Source

Fixed formatting addresses

main
M66B 6 years ago
parent
commit
4d2e61d66c
3 changed files with 9 additions and 7 deletions
  1. +2
    -2
      app/src/main/java/eu/faircode/email/AdapterMessage.java
  2. +4
    -4
      app/src/main/java/eu/faircode/email/FragmentMessage.java
  3. +3
    -1
      app/src/main/java/eu/faircode/email/MessageHelper.java

+ 2
- 2
app/src/main/java/eu/faircode/email/AdapterMessage.java View File

@ -89,10 +89,10 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
if (EntityFolder.DRAFTS.equals(message.folderType) ||
EntityFolder.OUTBOX.equals(message.folderType) ||
EntityFolder.SENT.equals(message.folderType)) {
tvFrom.setText(MessageHelper.getFormattedAddresses(message.to));
tvFrom.setText(MessageHelper.getFormattedAddresses(message.to, false));
tvTime.setText(DateUtils.getRelativeTimeSpanString(context, message.sent == null ? message.received : message.sent));
} else {
tvFrom.setText(MessageHelper.getFormattedAddresses(message.from));
tvFrom.setText(MessageHelper.getFormattedAddresses(message.from, false));
tvTime.setText(DateUtils.getRelativeTimeSpanString(context, message.received));
}


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

@ -257,10 +257,10 @@ public class FragmentMessage extends FragmentEx {
String extra = (debug ? (message.ui_hide ? "HIDDEN " : "") + message.uid + "/" + message.id + " " : "");
tvFrom.setText(message.from == null ? null : TextUtils.join(", ", message.from));
tvTo.setText(message.to == null ? null : TextUtils.join(", ", message.to));
tvCc.setText(message.cc == null ? null : TextUtils.join(", ", message.cc));
tvBcc.setText(message.bcc == null ? null : TextUtils.join(", ", message.bcc));
tvFrom.setText(message.from == null ? null : MessageHelper.getFormattedAddresses(message.from, true));
tvTo.setText(message.to == null ? null : MessageHelper.getFormattedAddresses(message.to, true));
tvCc.setText(message.cc == null ? null : MessageHelper.getFormattedAddresses(message.cc, true));
tvBcc.setText(message.bcc == null ? null : MessageHelper.getFormattedAddresses(message.bcc, true));
tvTime.setText(message.sent == null ? null : df.format(new Date(message.sent)));
tvSubject.setText(message.subject);
tvCount.setText(extra + Integer.toString(message.count));


+ 3
- 1
app/src/main/java/eu/faircode/email/MessageHelper.java View File

@ -166,7 +166,7 @@ public class MessageHelper {
return imessage.getReplyTo();
}
static String getFormattedAddresses(Address[] addresses) {
static String getFormattedAddresses(Address[] addresses, boolean full) {
if (addresses == null)
return null;
@ -177,6 +177,8 @@ public class MessageHelper {
String personal = a.getPersonal();
if (TextUtils.isEmpty(personal))
formatted.add(address.toString());
else if (full)
formatted.add(personal + " <" + a.getAddress() + ">");
else
formatted.add(personal);
} else


Loading…
Cancel
Save