1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-17 07:30:16 -05:00

Fixes Issue 856

This commit is contained in:
Daniel Applebaum 2009-12-05 13:47:28 +00:00
parent 514b4cf121
commit fe01446af6
5 changed files with 61 additions and 32 deletions

View File

@ -1,6 +1,8 @@
package com.android.email;
import com.android.email.activity.DateFormatter;
import android.app.Activity;
import android.os.Bundle;
@ -12,7 +14,33 @@ public class K9Activity extends Activity
{
setTheme(Email.getK9Theme());
super.onCreate(icicle);
setupFormats();
}
@Override
public void onResume()
{
super.onResume();
setupFormats();
}
private java.text.DateFormat mDateFormat;
private java.text.DateFormat mTimeFormat;
private void setupFormats()
{
mDateFormat = DateFormatter.getDateFormat(this);
mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format
}
public java.text.DateFormat getTimeFormat()
{
return mTimeFormat;
}
public java.text.DateFormat getDateFormat()
{
return mDateFormat;
}
}

View File

@ -1,5 +1,7 @@
package com.android.email;
import com.android.email.activity.DateFormatter;
import android.app.ListActivity;
import android.os.Bundle;
@ -11,7 +13,32 @@ public class K9ListActivity extends ListActivity
{
setTheme(Email.getK9Theme());
super.onCreate(icicle);
setupFormats();
}
@Override
public void onResume()
{
super.onResume();
setupFormats();
}
private java.text.DateFormat mDateFormat;
private java.text.DateFormat mTimeFormat;
private void setupFormats()
{
mDateFormat = DateFormatter.getDateFormat(this);
mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format
}
public java.text.DateFormat getTimeFormat()
{
return mTimeFormat;
}
public java.text.DateFormat getDateFormat()
{
return mDateFormat;
}
}

View File

@ -84,11 +84,6 @@ public class FolderList extends K9ListActivity
private boolean mStartup = false;
private java.text.DateFormat mDateFormat;
private java.text.DateFormat mTimeFormat;
class FolderListHandler extends Handler
{
@ -448,9 +443,6 @@ public class FolderList extends K9ListActivity
{
super.onResume();
mDateFormat = DateFormatter.getDateFormat(this);
mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format
MessagingController.getInstance(getApplication()).addListener(mAdapter.mListener);
mAccount.refresh(Preferences.getPreferences(this));
@ -1196,8 +1188,8 @@ public class FolderList extends K9ListActivity
{
Date lastCheckedDate = new Date(folder.lastChecked);
statusText = mTimeFormat.format(lastCheckedDate) + " "+
mDateFormat.format(lastCheckedDate);
statusText = getTimeFormat().format(lastCheckedDate) + " "+
getDateFormat().format(lastCheckedDate);
}
if (folder.pushActive)

View File

@ -132,11 +132,6 @@ public class MessageList
private Account mAccount;
private java.text.DateFormat mDateFormat;
private java.text.DateFormat mTimeFormat;
/**
* Stores the name of the folder that we want to open as soon as possible
* after load. It is set to null once the folder has been opened once.
@ -500,9 +495,6 @@ public class MessageList
{
super.onResume();
mDateFormat = DateFormatter.getDateFormat(this);
mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format
sortType = MessagingController.getInstance(getApplication()).getSortType();
sortAscending = MessagingController.getInstance(getApplication()).isSortAscending(sortType);
sortDateAscending = MessagingController.getInstance(getApplication()).isSortAscending(SORT_TYPE.SORT_DATE);
@ -1970,11 +1962,11 @@ public class MessageList
if (Utility.isDateToday(date))
{
this.date = mTimeFormat.format(date);
this.date = getTimeFormat().format(date);
}
else
{
this.date = mDateFormat.format(date);
this.date = getDateFormat().format(date);
}

View File

@ -95,11 +95,6 @@ public class MessageView extends K9Activity
private static final int ACTIVITY_CHOOSE_FOLDER_COPY = 2;
private java.text.DateFormat mDateFormat;
private java.text.DateFormat mTimeFormat;
private TextView mFromView;
private TextView mDateView;
private TextView mTimeView;
@ -745,11 +740,6 @@ public class MessageView extends K9Activity
public void onResume()
{
super.onResume();
mDateFormat = DateFormatter.getDateFormat(this);
mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format
}
private void onDelete()
@ -1405,8 +1395,8 @@ public class MessageView extends K9Activity
String fromText = Address.toFriendly(message.getFrom());
String dateText = Utility.isDateToday(message.getSentDate()) ?
null :
mDateFormat.format(message.getSentDate());
String timeText = mTimeFormat.format(message.getSentDate());
getDateFormat().format(message.getSentDate());
String timeText = getTimeFormat().format(message.getSentDate());
String toText = Address.toFriendly(message.getRecipients(RecipientType.TO));
String ccText = Address.toFriendly(message.getRecipients(RecipientType.CC));
Log.d(Email.LOG_TAG, ccText);