summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@google.com>2009-11-13 14:17:21 -0800
committerDaniel Sandler <dsandler@google.com>2009-11-13 14:17:21 -0800
commitc5eb3fa4bdce22c15f4fef74a51a293399f9a980 (patch)
treee7eca17b347c1122afab10853f72018bf5b7cbab
parent96757ff1498345bef8735791da1ca147b2247f13 (diff)
downloadbase-c5eb3fa4bdce22c15f4fef74a51a293399f9a980.tar.gz
Use new date format for lock screen.
Fixes http://b/issue?id=2247356 (well, it will once the format is updated to include the full day-of-week). Change-Id: Iaafbc60b7ff3edbfee7208052ecc1575cb8c226c
-rw-r--r--phone/com/android/internal/policy/impl/LockScreen.java28
-rw-r--r--phone/com/android/internal/policy/impl/UnlockScreen.java6
2 files changed, 7 insertions, 27 deletions
diff --git a/phone/com/android/internal/policy/impl/LockScreen.java b/phone/com/android/internal/policy/impl/LockScreen.java
index 43e1557..72d1447 100644
--- a/phone/com/android/internal/policy/impl/LockScreen.java
+++ b/phone/com/android/internal/policy/impl/LockScreen.java
@@ -82,7 +82,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
private boolean mSilentMode;
private AudioManager mAudioManager;
- private java.text.DateFormat mDateFormat;
+ private String mDateFormatString;
private java.text.DateFormat mTimeFormat;
private boolean mCreatedInPortrait;
private boolean mEnableMenuKeyInLockScreen;
@@ -243,7 +243,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
refreshAlarmDisplay();
mTimeFormat = DateFormat.getTimeFormat(getContext());
- mDateFormat = getLockScreenDateFormat();
+ mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year);
refreshTimeAndDateDisplay();
updateStatusLines();
}
@@ -369,29 +369,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
}
private void refreshTimeAndDateDisplay() {
- Date now = new Date();
- mDate.setText(mDateFormat.format(now));
- }
-
- /**
- * @return A localized format like "Fri, Sep 18, 2009"
- */
- private java.text.DateFormat getLockScreenDateFormat() {
- SimpleDateFormat adjusted = null;
- try {
- // this call gives us the localized order
- final SimpleDateFormat dateFormat = (SimpleDateFormat)
- java.text.DateFormat.getDateInstance(java.text.DateFormat.FULL);
- adjusted = new SimpleDateFormat(dateFormat.toPattern()
- .replace("MMMM", "MMM") // we want "Sep", not "September"
- .replace("EEEE", "EEE")); // we want "Fri", no "Friday"
- } catch (ClassCastException e) {
- // in case the library implementation changes and this throws a class cast exception
- // or anything else that is funky
- Log.e("LockScreen", "couldn't finnagle our custom date format :(", e);
- return java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM);
- }
- return adjusted;
+ mDate.setText(DateFormat.format(mDateFormatString, new Date()));
}
private void updateStatusLines() {
diff --git a/phone/com/android/internal/policy/impl/UnlockScreen.java b/phone/com/android/internal/policy/impl/UnlockScreen.java
index 2843dd4..f85b62f 100644
--- a/phone/com/android/internal/policy/impl/UnlockScreen.java
+++ b/phone/com/android/internal/policy/impl/UnlockScreen.java
@@ -71,6 +71,8 @@ class UnlockScreen extends LinearLayoutWithDefaultTouchRecepient
private boolean mCreatedInPortrait;
+ private String mDateFormatString;
+
private TextView mCarrier;
private TextView mDate;
@@ -169,6 +171,7 @@ class UnlockScreen extends LinearLayoutWithDefaultTouchRecepient
mCarrier = (TextView) findViewById(R.id.carrier);
mDate = (TextView) findViewById(R.id.date);
+ mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year);
refreshTimeAndDateDisplay();
mStatus1 = (TextView) findViewById(R.id.status1);
@@ -317,8 +320,7 @@ class UnlockScreen extends LinearLayoutWithDefaultTouchRecepient
private void refreshTimeAndDateDisplay() {
- Date now = new Date();
- mDate.setText(DateFormat.getMediumDateFormat(getContext()).format(now));
+ mDate.setText(DateFormat.format(mDateFormatString, new Date()));
}