mirror of https://github.com/M66B/FairEmail.git
Warning color for messages with unknown identity
This commit is contained in:
parent
c5df0034e3
commit
5aa35797f1
|
@ -161,6 +161,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
private float textSize;
|
private float textSize;
|
||||||
private int colorPrimary;
|
private int colorPrimary;
|
||||||
private int colorAccent;
|
private int colorAccent;
|
||||||
|
private int colorWarning;
|
||||||
private int textColorSecondary;
|
private int textColorSecondary;
|
||||||
private int colorUnread;
|
private int colorUnread;
|
||||||
private boolean hasWebView;
|
private boolean hasWebView;
|
||||||
|
@ -805,13 +806,22 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
String cc = MessageHelper.formatAddresses(message.cc);
|
String cc = MessageHelper.formatAddresses(message.cc);
|
||||||
String bcc = MessageHelper.formatAddresses(message.bcc);
|
String bcc = MessageHelper.formatAddresses(message.bcc);
|
||||||
|
|
||||||
String identity;
|
boolean self = false;
|
||||||
try {
|
InternetAddress via = null;
|
||||||
InternetAddress via = new InternetAddress(message.identityEmail, message.identityName);
|
if (message.identityEmail != null)
|
||||||
identity = MessageHelper.formatAddresses(new Address[]{via});
|
try {
|
||||||
} catch (UnsupportedEncodingException ex) {
|
via = new InternetAddress(message.identityEmail, message.identityName);
|
||||||
identity = ex.getMessage();
|
if (message.to != null) {
|
||||||
}
|
String v = Helper.canonicalAddress(via.getAddress());
|
||||||
|
for (Address t : message.to) {
|
||||||
|
if (v.equals(Helper.canonicalAddress(((InternetAddress) t).getAddress()))) {
|
||||||
|
self = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (UnsupportedEncodingException ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
tvFromExTitle.setVisibility(show_addresses && !TextUtils.isEmpty(from) ? View.VISIBLE : View.GONE);
|
tvFromExTitle.setVisibility(show_addresses && !TextUtils.isEmpty(from) ? View.VISIBLE : View.GONE);
|
||||||
tvFromEx.setVisibility(show_addresses && !TextUtils.isEmpty(from) ? View.VISIBLE : View.GONE);
|
tvFromEx.setVisibility(show_addresses && !TextUtils.isEmpty(from) ? View.VISIBLE : View.GONE);
|
||||||
|
@ -820,6 +830,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
tvToTitle.setVisibility(show_addresses && !TextUtils.isEmpty(to) ? View.VISIBLE : View.GONE);
|
tvToTitle.setVisibility(show_addresses && !TextUtils.isEmpty(to) ? View.VISIBLE : View.GONE);
|
||||||
tvTo.setVisibility(show_addresses && !TextUtils.isEmpty(to) ? View.VISIBLE : View.GONE);
|
tvTo.setVisibility(show_addresses && !TextUtils.isEmpty(to) ? View.VISIBLE : View.GONE);
|
||||||
tvTo.setText(to);
|
tvTo.setText(to);
|
||||||
|
tvToTitle.setTextColor(self ? textColorSecondary : colorWarning);
|
||||||
|
tvTo.setTextColor(self ? textColorSecondary : colorWarning);
|
||||||
|
|
||||||
tvReplyToTitle.setVisibility(show_addresses && !TextUtils.isEmpty(replyto) ? View.VISIBLE : View.GONE);
|
tvReplyToTitle.setVisibility(show_addresses && !TextUtils.isEmpty(replyto) ? View.VISIBLE : View.GONE);
|
||||||
tvReplyTo.setVisibility(show_addresses && !TextUtils.isEmpty(replyto) ? View.VISIBLE : View.GONE);
|
tvReplyTo.setVisibility(show_addresses && !TextUtils.isEmpty(replyto) ? View.VISIBLE : View.GONE);
|
||||||
|
@ -833,9 +845,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
tvBcc.setVisibility(show_addresses && !TextUtils.isEmpty(bcc) ? View.VISIBLE : View.GONE);
|
tvBcc.setVisibility(show_addresses && !TextUtils.isEmpty(bcc) ? View.VISIBLE : View.GONE);
|
||||||
tvBcc.setText(bcc);
|
tvBcc.setText(bcc);
|
||||||
|
|
||||||
tvIdentityTitle.setVisibility(show_addresses && debug && !TextUtils.isEmpty(identity) ? View.VISIBLE : View.GONE);
|
tvIdentityTitle.setVisibility(show_addresses && via != null ? View.VISIBLE : View.GONE);
|
||||||
tvIdentity.setVisibility(show_addresses && debug && !TextUtils.isEmpty(identity) ? View.VISIBLE : View.GONE);
|
tvIdentity.setVisibility(show_addresses && via != null ? View.VISIBLE : View.GONE);
|
||||||
tvIdentity.setText(identity);
|
tvIdentity.setText(MessageHelper.formatAddresses(new Address[]{via}));
|
||||||
|
|
||||||
tvTimeExTitle.setVisibility(show_addresses ? View.VISIBLE : View.GONE);
|
tvTimeExTitle.setVisibility(show_addresses ? View.VISIBLE : View.GONE);
|
||||||
tvTimeEx.setVisibility(show_addresses ? View.VISIBLE : View.GONE);
|
tvTimeEx.setVisibility(show_addresses ? View.VISIBLE : View.GONE);
|
||||||
|
@ -2889,6 +2901,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
this.textSize = Helper.getTextSize(context, zoom);
|
this.textSize = Helper.getTextSize(context, zoom);
|
||||||
this.colorPrimary = Helper.resolveColor(context, R.attr.colorPrimary);
|
this.colorPrimary = Helper.resolveColor(context, R.attr.colorPrimary);
|
||||||
this.colorAccent = Helper.resolveColor(context, R.attr.colorAccent);
|
this.colorAccent = Helper.resolveColor(context, R.attr.colorAccent);
|
||||||
|
this.colorWarning = Helper.resolveColor(context, R.attr.colorWarning);
|
||||||
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
|
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
|
||||||
this.colorUnread = Helper.resolveColor(context, R.attr.colorUnread);
|
this.colorUnread = Helper.resolveColor(context, R.attr.colorUnread);
|
||||||
this.hasWebView = Helper.hasWebView(context);
|
this.hasWebView = Helper.hasWebView(context);
|
||||||
|
|
Loading…
Reference in New Issue