Merge "Added the via domain to the UI." into jb-ub-mail
diff --git a/res/layout/conversation_message_details_header_expanded.xml b/res/layout/conversation_message_details_header_expanded.xml
index a0184a5..5410333 100644
--- a/res/layout/conversation_message_details_header_expanded.xml
+++ b/res/layout/conversation_message_details_header_expanded.xml
@@ -40,6 +40,18 @@
style="@style/MessageDetailsValueStyle" />
</TableRow>
<TableRow
+ android:id="@+id/from_row"
+ android:visibility="gone">
+ <TextView
+ android:id="@+id/from_heading"
+ android:text="@string/from_heading"
+ style="@style/MessageDetailsHeadingStyle" />
+ <TextView
+ android:id="@+id/from_value"
+ android:autoLink="email"
+ style="@style/MessageDetailsValueSelectableStyle" />
+ </TableRow>
+ <TableRow
android:id="@+id/replyto_row"
android:visibility="gone">
<TextView
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e65949b..9ffa09d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -495,6 +495,8 @@
<string name="show_messages_read">Previously read messages</string>
<!-- Shown to display the date of the message [CHAR LIMIT=10] -->
<string name="date_heading">Date:</string>
+ <!-- Shown to display the from address of the message [CHAR LIMIT=10] -->
+ <string name="from_heading">From:</string>
<!-- Shown to display the reply to address of the message [CHAR LIMIT=20] -->
<string name="replyto_heading">Reply-to:</string>
<!-- Shown to display the recipient(s) of the message [CHAR LIMIT=10] -->
@@ -511,6 +513,8 @@
<string name="always_show_images_toast">Pictures from this sender will be shown automatically.</string>
<!-- Display format of an email recipient, displayed in expanded message details [CHAR LIMIT=10] -->
<string name="address_display_format"><xliff:g id="name">%1$s</xliff:g> <<xliff:g id="email">%2$s</xliff:g>></string>
+ <!-- Display format of an email sender if the message has a via domain set, displayed in expanded message details [CHAR LIMIT=15] -->
+ <string name="address_display_format_with_via_domain"><xliff:g id="name">%1$s</xliff:g> <<xliff:g id="email">%2$s</xliff:g>> via <xliff:g id="via_domain">%3$s</xliff:g></string>
<!-- Displayed for one second after user saves message as draft [CHAR LIMIT=50]-->
<string name="message_saved">Message saved as draft.</string>
<!-- Displayed for one second while message is being sent [CHAR LIMIT=50]-->
@@ -716,6 +720,9 @@
<!-- Displayed in a message subheading. Ignore the current spam warning. [CHAR LIMIT=30] -->
<string name="ignore_spam_warning">Ignore, I trust this message</string>
+ <!-- Displayed in the message heading. Shown if the message was sent via another domain. [CHAR LIMIT=10] -->
+ <string name="via_domain">via <xliff:g id="viaDomain">%1$s</xliff:g></string>
+
<!-- The section headers for the move to folder dialog [CHAR LIMIT=15] -->
<string-array name="moveto_folder_sections">
<item>System</item>
diff --git a/src/com/android/mail/browse/MessageHeaderView.java b/src/com/android/mail/browse/MessageHeaderView.java
index 1367281..f82d1ea 100644
--- a/src/com/android/mail/browse/MessageHeaderView.java
+++ b/src/com/android/mail/browse/MessageHeaderView.java
@@ -110,6 +110,7 @@
// temporary fields to reference raw data between initial render and details
// expansion
+ private String[] mFrom;
private String[] mTo;
private String[] mCc;
private String[] mBcc;
@@ -351,6 +352,7 @@
headerItem.timestampShort = mTimestampShort;
}
+ mFrom = mMessage.getFromAddresses();
mTo = mMessage.getToAddresses();
mCc = mMessage.getCcAddresses();
mBcc = mMessage.getBccAddresses();
@@ -464,7 +466,16 @@
if (mIsSending) {
sub = null;
} else {
- sub = isExpanded() ? getSenderAddress(mSender) : mSnippet;
+ if (isExpanded()) {
+ if (mMessage.viaDomain != null) {
+ sub = getResources().getString(
+ R.string.via_domain, mMessage.viaDomain);
+ } else {
+ sub = getSenderAddress(mSender);
+ }
+ } else {
+ sub = mSnippet;
+ }
}
return sub;
}
@@ -588,7 +599,7 @@
childView.setLayoutParams(mlp);
}
- private void renderEmailList(int rowRes, int valueRes, String[] emails) {
+ private void renderEmailList(int rowRes, int valueRes, String[] emails, boolean showViaDomain) {
if (emails == null || emails.length == 0) {
return;
}
@@ -600,8 +611,16 @@
if (name == null || name.length() == 0) {
formattedEmails[i] = addr;
} else {
- formattedEmails[i] = getResources().getString(R.string.address_display_format,
- name, addr);
+ // The one downside to having the showViaDomain here is that
+ // if the sender does not have a name, it will not show the via info
+ if (showViaDomain) {
+ formattedEmails[i] = getResources().getString(
+ R.string.address_display_format_with_via_domain,
+ name, addr, mMessage.viaDomain);
+ } else {
+ formattedEmails[i] = getResources().getString(R.string.address_display_format,
+ name, addr);
+ }
}
}
((TextView) findViewById(valueRes)).setText(TextUtils.join("\n", formattedEmails));
@@ -1073,10 +1092,13 @@
mMessageHeaderItem.timestampLong = mDateBuilder.formatLongDateTime(mTimestampMs);
}
((TextView) findViewById(R.id.date_value)).setText(mMessageHeaderItem.timestampLong);
- renderEmailList(R.id.replyto_row, R.id.replyto_value, mReplyTo);
- renderEmailList(R.id.to_row, R.id.to_value, mTo);
- renderEmailList(R.id.cc_row, R.id.cc_value, mCc);
- renderEmailList(R.id.bcc_row, R.id.bcc_value, mBcc);
+ renderEmailList(R.id.replyto_row, R.id.replyto_value, mReplyTo, false);
+ if (mMessage.viaDomain != null) {
+ renderEmailList(R.id.from_row, R.id.from_value, mFrom, true);
+ }
+ renderEmailList(R.id.to_row, R.id.to_value, mTo, false);
+ renderEmailList(R.id.cc_row, R.id.cc_value, mCc, false);
+ renderEmailList(R.id.bcc_row, R.id.bcc_value, mBcc, false);
mExpandedDetailsValid = true;
}
diff --git a/src/com/android/mail/providers/Message.java b/src/com/android/mail/providers/Message.java
index 9a66dc2..46a9605 100644
--- a/src/com/android/mail/providers/Message.java
+++ b/src/com/android/mail/providers/Message.java
@@ -156,10 +156,24 @@
* @see UIProvider.MessageColumns#EVENT_INTENT_URI
*/
public Uri eventIntentUri;
+ /**
+ * @see UIProvider.MessageColumns#SPAM_WARNING_STRING
+ */
public String spamWarningString;
+ /**
+ * @see UIProvider.MessageColumns#SPAM_WARNING_LEVEL
+ */
public int spamWarningLevel;
+ /**
+ * @see UIProvider.MessageColumns#SPAM_WARNING_LINK_TYPE
+ */
public int spamLinkType;
+ /**
+ * @see UIProvider.MessageColumns#VIA_DOMAIN
+ */
+ public String viaDomain;
+ private transient String[] mFromAddresses = null;
private transient String[] mToAddresses = null;
private transient String[] mCcAddresses = null;
private transient String[] mBccAddresses = null;
@@ -226,6 +240,7 @@
dest.writeString(spamWarningString);
dest.writeInt(spamWarningLevel);
dest.writeInt(spamLinkType);
+ dest.writeString(viaDomain);
}
private Message(Parcel in) {
@@ -260,6 +275,7 @@
spamWarningString = in.readString();
spamWarningLevel = in.readInt();
spamLinkType = in.readInt();
+ viaDomain = in.readString();
}
public Message() {
@@ -338,6 +354,7 @@
cursor.getString(UIProvider.MESSAGE_SPAM_WARNING_STRING_ID_COLUMN);
spamWarningLevel = cursor.getInt(UIProvider.MESSAGE_SPAM_WARNING_LEVEL_COLUMN);
spamLinkType = cursor.getInt(UIProvider.MESSAGE_SPAM_WARNING_LINK_TYPE_COLUMN);
+ viaDomain = cursor.getString(UIProvider.MESSAGE_VIA_DOMAIN_COLUMN);
}
}
@@ -356,6 +373,13 @@
UIProvider.MessageFlags.CALENDAR_INVITE;
}
+ public synchronized String[] getFromAddresses() {
+ if (mFromAddresses == null) {
+ mFromAddresses = Utils.splitCommaSeparatedString(from);
+ }
+ return mFromAddresses;
+ }
+
public synchronized String[] getToAddresses() {
if (mToAddresses == null) {
mToAddresses = Utils.splitCommaSeparatedString(to);
diff --git a/src/com/android/mail/providers/UIProvider.java b/src/com/android/mail/providers/UIProvider.java
index bb9dab5..f21cd5f 100644
--- a/src/com/android/mail/providers/UIProvider.java
+++ b/src/com/android/mail/providers/UIProvider.java
@@ -1056,7 +1056,8 @@
MessageColumns.EVENT_INTENT_URI,
MessageColumns.SPAM_WARNING_STRING,
MessageColumns.SPAM_WARNING_LEVEL,
- MessageColumns.SPAM_WARNING_LINK_TYPE
+ MessageColumns.SPAM_WARNING_LINK_TYPE,
+ MessageColumns.VIA_DOMAIN
};
/** Separates attachment info parts in strings in a message. */
@@ -1102,7 +1103,7 @@
public static final int MESSAGE_SPAM_WARNING_STRING_ID_COLUMN = 32;
public static final int MESSAGE_SPAM_WARNING_LEVEL_COLUMN = 33;
public static final int MESSAGE_SPAM_WARNING_LINK_TYPE_COLUMN = 34;
-
+ public static final int MESSAGE_VIA_DOMAIN_COLUMN = 35;
public static final class CursorStatus {
// The cursor is actively loading more data
@@ -1293,7 +1294,7 @@
*/
public static final String EVENT_INTENT_URI = "eventIntentUri";
/**
- * This string column contains the stringfor the spam
+ * This string column contains the string for the spam
* warning of this message, or null if there is no spam warning for the message.
*/
public static final String SPAM_WARNING_STRING = "spamWarningString";
@@ -1309,6 +1310,12 @@
* See {@link SpamWarningLinkType} for possible values.
*/
public static final String SPAM_WARNING_LINK_TYPE = "spamWarningLinkType";
+ /**
+ * This string column contains the string for the via domain
+ * to be included if this message was sent via an alternate
+ * domain. This column should be null if no via domain exists.
+ */
+ public static final String VIA_DOMAIN = "viaDomain";
private MessageColumns() {}
}