1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-16 06:25:06 -05:00

Fixed issue 126

+ display both date and time on old emails
This commit is contained in:
Bao-Long Nguyen-Trong 2009-06-14 14:03:30 +00:00
parent 339c8e247b
commit 9dfe3d8f7b
3 changed files with 62 additions and 7 deletions

View File

@ -50,6 +50,41 @@
android:layout_marginLeft="4px" android:layout_marginLeft="4px"
android:singleLine="false" android:singleLine="false"
android:ellipsize="none" /> android:ellipsize="none" />
<TextView
android:id="@+id/time"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:layout_width="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/cc_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@id/to_container">
<TextView
android:id="@+id/cc_label"
android:textSize="10sp"
android:textColor="?android:attr/textColorSecondary"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_view_cc_label" />
<TextView
android:id="@+id/cc"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:textSize="10sp"
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:layout_marginLeft="4px"
android:singleLine="false"
android:ellipsize="none" />
<TextView <TextView
android:id="@+id/date" android:id="@+id/date"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
@ -64,7 +99,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_below="@id/to_container"> android:layout_below="@id/cc_container">
<TextView <TextView
android:id="@+id/subject" android:id="@+id/subject"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"

View File

@ -197,6 +197,7 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
<string name="message_view_from_format">From: <xliff:g id="name">%s</xliff:g> &lt;<xliff:g id="email">%s</xliff:g>&gt;</string> <string name="message_view_from_format">From: <xliff:g id="name">%s</xliff:g> &lt;<xliff:g id="email">%s</xliff:g>&gt;</string>
<string name="message_view_to_label">To:</string> <string name="message_view_to_label">To:</string>
<string name="message_view_cc_label">Cc:</string>
<string name="message_view_attachment_view_action">Open</string> <string name="message_view_attachment_view_action">Open</string>
<string name="message_view_attachment_download_action">Save</string> <string name="message_view_attachment_download_action">Save</string>
<string name="message_view_prev_action"></string> <string name="message_view_prev_action"></string>

View File

@ -89,7 +89,9 @@ public class MessageView extends K9Activity
private TextView mFromView; private TextView mFromView;
private TextView mDateView; private TextView mDateView;
private TextView mTimeView;
private TextView mToView; private TextView mToView;
private TextView mCcView;
private TextView mSubjectView; private TextView mSubjectView;
private int defaultSubjectColor; private int defaultSubjectColor;
private WebView mMessageContentView; private WebView mMessageContentView;
@ -217,8 +219,16 @@ public class MessageView extends K9Activity
setTitle(values[0]); setTitle(values[0]);
mSubjectView.setText(values[0]); mSubjectView.setText(values[0]);
mFromView.setText(values[1]); mFromView.setText(values[1]);
if (values[2]!=null) {
mDateView.setText(values[2]); mDateView.setText(values[2]);
mToView.setText(values[3]); mDateView.setVisibility(View.VISIBLE);
}
else {
mDateView.setVisibility(View.GONE);
}
mTimeView.setText(values[3]);
mToView.setText(values[4]);
mCcView.setText(values[5]);
mAttachmentIcon.setVisibility(msg.arg1 == 1 ? View.VISIBLE : View.GONE); mAttachmentIcon.setVisibility(msg.arg1 == 1 ? View.VISIBLE : View.GONE);
if ((msg.arg2 & FLAG_FLAGGED) != 0) { if ((msg.arg2 & FLAG_FLAGGED) != 0) {
mSubjectView.setTextColor(0xff000000 | Email.FLAGGED_COLOR); mSubjectView.setTextColor(0xff000000 | Email.FLAGGED_COLOR);
@ -289,7 +299,9 @@ public class MessageView extends K9Activity
String subject, String subject,
String from, String from,
String date, String date,
String time,
String to, String to,
String cc,
boolean hasAttachments, boolean hasAttachments,
boolean flagged, boolean flagged,
boolean seen) { boolean seen) {
@ -299,7 +311,7 @@ public class MessageView extends K9Activity
msg.arg2 += (flagged ? FLAG_FLAGGED : 0); msg.arg2 += (flagged ? FLAG_FLAGGED : 0);
msg.arg2 += (seen ? FLAG_ANSWERED : 0); msg.arg2 += (seen ? FLAG_ANSWERED : 0);
msg.obj = new String[] { subject, from, date, to }; msg.obj = new String[] { subject, from, date, time, to, cc };
sendMessage(msg); sendMessage(msg);
} }
@ -369,11 +381,13 @@ public class MessageView extends K9Activity
mFromView = (TextView)findViewById(R.id.from); mFromView = (TextView)findViewById(R.id.from);
mToView = (TextView)findViewById(R.id.to); mToView = (TextView)findViewById(R.id.to);
mCcView = (TextView)findViewById(R.id.cc);
mSubjectView = (TextView)findViewById(R.id.subject); mSubjectView = (TextView)findViewById(R.id.subject);
defaultSubjectColor = mSubjectView.getCurrentTextColor(); defaultSubjectColor = mSubjectView.getCurrentTextColor();
mDateView = (TextView)findViewById(R.id.date); mDateView = (TextView)findViewById(R.id.date);
mTimeView = (TextView)findViewById(R.id.time);
mMessageContentView = (WebView)findViewById(R.id.message_content); mMessageContentView = (WebView)findViewById(R.id.message_content);
//mMessageContentView.setWebViewClient(new MessageWebViewClient()); //mMessageContentView.setWebViewClient(new MessageWebViewClient());
mAttachments = (LinearLayout)findViewById(R.id.attachments); mAttachments = (LinearLayout)findViewById(R.id.attachments);
@ -1079,14 +1093,19 @@ public class MessageView extends K9Activity
String subjectText = message.getSubject(); String subjectText = message.getSubject();
String fromText = Address.toFriendly(message.getFrom()); String fromText = Address.toFriendly(message.getFrom());
String dateText = Utility.isDateToday(message.getSentDate()) ? String dateText = Utility.isDateToday(message.getSentDate()) ?
getTimeFormat().format(message.getSentDate()) : null :
getDateFormat().format(message.getSentDate()); getDateFormat().format(message.getSentDate());
String timeText = getTimeFormat().format(message.getSentDate());
String toText = Address.toFriendly(message.getRecipients(RecipientType.TO)); String toText = Address.toFriendly(message.getRecipients(RecipientType.TO));
String ccText = Address.toFriendly(message.getRecipients(RecipientType.CC));
Log.d(Email.LOG_TAG, ccText);
boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0; boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0;
mHandler.setHeaders(subjectText, mHandler.setHeaders(subjectText,
fromText, fromText,
dateText, dateText,
timeText,
toText, toText,
ccText,
hasAttachments, hasAttachments,
message.isSet(Flag.FLAGGED), message.isSet(Flag.FLAGGED),
message.isSet(Flag.ANSWERED)); message.isSet(Flag.ANSWERED));