Fixed formatting addresses

pull/30/head
M66B 7 years ago
parent 4d7f6b5f6e
commit 4d2e61d66c

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

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

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

Loading…
Cancel
Save