1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 11:15:51 +00:00

Layout improvements

This commit is contained in:
M66B 2019-01-20 10:18:42 +00:00
parent b472b65bf5
commit f721285d7c
2 changed files with 17 additions and 7 deletions

View file

@ -73,6 +73,7 @@ import org.xml.sax.XMLReader;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.Collator; import java.text.Collator;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -459,7 +460,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if ((long) tvFrom.getTag() == id) { if ((long) tvFrom.getTag() == id) {
if (info != null && info.hasDisplayName()) if (info != null && info.hasDisplayName())
tvFrom.setText(info.getDisplayName()); try {
Address[] addresses = (Address[]) args.getSerializable("addresses");
InternetAddress ia = (InternetAddress) addresses[0];
ia.setPersonal(info.getDisplayName());
tvFrom.setText(MessageHelper.formatAddresses(new Address[]{ia}, !compact, false));
} catch (UnsupportedEncodingException ex) {
Log.w(ex);
}
} }
} }
@ -485,7 +493,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ivFlagged.setImageTintList(ColorStateList.valueOf(flagged > 0 ? colorAccent : textColorSecondary)); ivFlagged.setImageTintList(ColorStateList.valueOf(flagged > 0 ? colorAccent : textColorSecondary));
ivFlagged.setVisibility(message.uid == null ? View.INVISIBLE : View.VISIBLE); ivFlagged.setVisibility(message.uid == null ? View.INVISIBLE : View.VISIBLE);
tvFrom.setText(MessageHelper.formatAddressesShort(outgoing ? message.to : message.from)); tvFrom.setText(MessageHelper.formatAddresses(outgoing ? message.to : message.from, !compact, false));
tvSize.setText(message.size == null ? null : Helper.humanReadableByteCount(message.size, true)); tvSize.setText(message.size == null ? null : Helper.humanReadableByteCount(message.size, true));
tvSize.setVisibility(message.size == null || message.content ? View.GONE : View.VISIBLE); tvSize.setVisibility(message.size == null || message.content ? View.GONE : View.VISIBLE);
tvTime.setText(DateUtils.getRelativeTimeSpanString(context, message.received)); tvTime.setText(DateUtils.getRelativeTimeSpanString(context, message.received));
@ -500,12 +508,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvNoInternetAttachments.setVisibility(View.GONE); tvNoInternetAttachments.setVisibility(View.GONE);
tvSubject.setText(message.subject); tvSubject.setText(message.subject);
if (viewType == ViewType.THREAD || viewType == ViewType.SEARCH) if (viewType == ViewType.FOLDER)
tvFolder.setText(message.folderDisplay == null tvFolder.setText(message.accountName);
else {
String folderName = (message.folderDisplay == null
? Helper.localizeFolderName(context, message.folderName) ? Helper.localizeFolderName(context, message.folderName)
: message.folderDisplay); : message.folderDisplay);
else tvFolder.setText((compact ? "" : message.accountName + "/") + folderName);
tvFolder.setText(message.accountName); }
tvFolder.setVisibility(viewType == ViewType.FOLDER && compact ? View.GONE : View.VISIBLE); tvFolder.setVisibility(viewType == ViewType.FOLDER && compact ? View.GONE : View.VISIBLE);
tvPreview.setText(message.preview); tvPreview.setText(message.preview);

View file

@ -533,7 +533,7 @@ public class MessageHelper {
return result; return result;
} }
private static String formatAddresses(Address[] addresses, boolean full, boolean compose) { static String formatAddresses(Address[] addresses, boolean full, boolean compose) {
if (addresses == null || addresses.length == 0) if (addresses == null || addresses.length == 0)
return ""; return "";