Show date in expanded header. b/10564577.
Change-Id: I8d59f361be68a0e7beda1584d1fd4bcdb6387959
diff --git a/res/layout/conversation_message_details_header_expanded.xml b/res/layout/conversation_message_details_header_expanded.xml
index af2bcbf..f63cac6 100644
--- a/res/layout/conversation_message_details_header_expanded.xml
+++ b/res/layout/conversation_message_details_header_expanded.xml
@@ -26,7 +26,7 @@
android:paddingLeft="@dimen/message_details_header_padding_start_collapsed"
android:paddingRight="@dimen/message_details_header_padding_end"
app:columnCount="3"
- app:rowCount="5" >
+ app:rowCount="6" >
<TextView
android:id="@+id/from_heading"
@@ -143,5 +143,26 @@
app:layout_row="4"
android:visibility="gone"
style="@style/MessageDetailsValueStyle" />
+ <TextView
+ android:id="@+id/date_heading"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/message_header_inner_side_padding"
+ android:layout_marginRight="@dimen/message_header_inner_side_padding"
+ app:layout_column="0"
+ app:layout_row="5"
+ android:text="@string/date_heading"
+ android:visibility="gone"
+ style="@style/MessageHeaderSmallStyle" />
+ <TextView
+ android:id="@+id/date_details"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ app:layout_gravity="fill_horizontal"
+ android:layout_marginBottom="4dp"
+ app:layout_column="1"
+ app:layout_row="5"
+ android:visibility="gone"
+ style="@style/MessageDetailsValueStyle" />
</android.support.v7.widget.GridLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 67ebd10..4f6f08e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -461,18 +461,18 @@
<plurals name="show_messages_read">
<item quantity="other"><xliff:g id="count" example="4">%1$d</xliff:g> older messages</item>
</plurals>
-
+ <!-- Shown to display the from address of the message [CHAR LIMIT=10] -->
<string name="from_heading">From:\u0020</string>
<!-- Shown to display the reply to address of the message [CHAR LIMIT=20] -->
<string name="replyto_heading">Reply-to:\u0020</string>
- <!-- Shown to display the recipient(s) of the message [CHAR LIMIT=10] -->
- <!-- Shown in HTML to display the recipient(s) of the message [CHAR LIMIT=10] -->
+ <!-- Shown to display the to recipient(s) of the message [CHAR LIMIT=10] -->
<string name="to_heading">To:\u0020</string>
- <!-- Shown in HTML to display the recipient(s) of the message [CHAR LIMIT=10] -->
+ <!-- Shown to display the cc recipient(s) of the message [CHAR LIMIT=10] -->
<string name="cc_heading">Cc:\u0020</string>
- <!-- Shown in HTML to display the recipient(s) of the message [CHAR LIMIT=10] -->
+ <!-- Shown to display the bcc recipient(s) of the message [CHAR LIMIT=10] -->
<string name="bcc_heading">Bcc:\u0020</string>
- <!-- Shown to display the from address of the message [CHAR LIMIT=10] -->
+ <!-- Shown to display the recipient(s) of the message [CHAR LIMIT=10] -->
+ <string name="date_heading">Date:\u0020</string>
<!-- Displayed above an HTML message to show the images in that message [CHAR LIMIT=40] -->
<string name="show_images">Show pictures</string>
<!-- Displayed above an HTML message to always show images in messages from that sender [CHAR LIMIT=40] -->
diff --git a/src/com/android/mail/browse/MessageHeaderDetailsDialogFragment.java b/src/com/android/mail/browse/MessageHeaderDetailsDialogFragment.java
index b6e6603..92a4f3c 100644
--- a/src/com/android/mail/browse/MessageHeaderDetailsDialogFragment.java
+++ b/src/com/android/mail/browse/MessageHeaderDetailsDialogFragment.java
@@ -45,6 +45,7 @@
private static final String ARG_TO = "to";
private static final String ARG_CC = "cc";
private static final String ARG_BCC = "bcc";
+ private static final String ARG_RECEIVED_TIME = "received-timestamp";
// Public no-args constructor needed for fragment re-instantiation
public MessageHeaderDetailsDialogFragment() {}
@@ -63,7 +64,7 @@
*/
public static MessageHeaderDetailsDialogFragment newInstance(
Map<String, Address> addressCache, Account account, String[] from, String[] replyTo,
- String[] to, String[] cc, String[] bcc) {
+ String[] to, String[] cc, String[] bcc, CharSequence receivedTimestamp) {
final MessageHeaderDetailsDialogFragment f = new MessageHeaderDetailsDialogFragment();
// Supply needed items as arguments
@@ -83,6 +84,7 @@
args.putStringArray(ARG_TO, to);
args.putStringArray(ARG_CC, cc);
args.putStringArray(ARG_BCC, bcc);
+ args.putCharSequence(ARG_RECEIVED_TIME, receivedTimestamp);
f.setArguments(args);
return f;
@@ -115,7 +117,7 @@
addressCache, (Account) args.getParcelable(ARG_ACCOUNT), null,
args.getStringArray(ARG_FROM), args.getStringArray(ARG_REPLY_TO),
args.getStringArray(ARG_TO), args.getStringArray(ARG_CC),
- args.getStringArray(ARG_BCC));
+ args.getStringArray(ARG_BCC), args.getCharSequence(ARG_RECEIVED_TIME));
expandedDetails.findViewById(R.id.details_expander)
.setVisibility(View.GONE);
diff --git a/src/com/android/mail/browse/MessageHeaderView.java b/src/com/android/mail/browse/MessageHeaderView.java
index 9f736d5..ed47bf5 100644
--- a/src/com/android/mail/browse/MessageHeaderView.java
+++ b/src/com/android/mail/browse/MessageHeaderView.java
@@ -1279,7 +1279,8 @@
}
if (!mExpandedDetailsValid) {
renderExpandedDetails(getResources(), mExpandedDetailsView, mMessage.viaDomain,
- mAddressCache, getAccount(), mVeiledMatcher, mFrom, mReplyTo, mTo, mCc, mBcc);
+ mAddressCache, getAccount(), mVeiledMatcher, mFrom, mReplyTo, mTo, mCc, mBcc,
+ mMessageHeaderItem.getTimestampLong());
mExpandedDetailsValid = true;
}
@@ -1294,7 +1295,7 @@
public static void renderExpandedDetails(Resources res, View detailsView,
String viaDomain, Map<String, Address> addressCache, Account account,
VeiledAddressMatcher veiledMatcher, String[] from, String[] replyTo,
- String[] to, String[] cc, String[] bcc) {
+ String[] to, String[] cc, String[] bcc, CharSequence receivedTimestamp) {
renderEmailList(res, R.id.from_heading, R.id.from_details, from, viaDomain,
detailsView, addressCache, account, veiledMatcher);
renderEmailList(res, R.id.replyto_heading, R.id.replyto_details, replyTo, viaDomain,
@@ -1305,6 +1306,12 @@
detailsView, addressCache, account, veiledMatcher);
renderEmailList(res, R.id.bcc_heading, R.id.bcc_details, bcc, viaDomain,
detailsView, addressCache, account, veiledMatcher);
+
+ // Render date
+ detailsView.findViewById(R.id.date_heading).setVisibility(VISIBLE);
+ final TextView date = (TextView) detailsView.findViewById(R.id.date_details);
+ date.setText(receivedTimestamp);
+ date.setVisibility(VISIBLE);
}
/**
@@ -1383,7 +1390,8 @@
mDetailsPopup = (DialogFragment) manager.findFragmentByTag(DETAILS_DIALOG_TAG);
if (mDetailsPopup == null) {
mDetailsPopup = MessageHeaderDetailsDialogFragment.newInstance(
- mAddressCache, getAccount(), mFrom, mReplyTo, mTo, mCc, mBcc);
+ mAddressCache, getAccount(), mFrom, mReplyTo, mTo, mCc, mBcc,
+ mMessageHeaderItem.getTimestampLong());
mDetailsPopup.show(manager, DETAILS_DIALOG_TAG);
}
}