diff options
| author | 2013-10-08 15:32:09 -0700 | |
|---|---|---|
| committer | 2013-10-08 15:32:09 -0700 | |
| commit | 38ab277ad478b1c858a852ba900ec0cd85fe2d2d (patch) | |
| tree | 4bddbb3df0a6ab3f3d62b1c60f0a9c4c24909d0e | |
| parent | c739a765981174dc82bf268c379a5c7bc17167f4 (diff) | |
Fix default clock localization in keyguard.
Uses new DateFormat.getBestDateTimePattern() to get localized format
string.
Fixes bug 11120830
Change-Id: If49a95ac4f222da7d16523c99476c5895326d71e
3 files changed, 12 insertions, 12 deletions
diff --git a/packages/Keyguard/res/layout/keyguard_status_area.xml b/packages/Keyguard/res/layout/keyguard_status_area.xml index d1f387375668..98ba51241be8 100644 --- a/packages/Keyguard/res/layout/keyguard_status_area.xml +++ b/packages/Keyguard/res/layout/keyguard_status_area.xml @@ -29,8 +29,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/clock_white" - android:format12Hour="@string/abbrev_wday_month_day_no_year" - android:format24Hour="@string/abbrev_wday_month_day_no_year" style="@style/widget_label" android:gravity="center" /> diff --git a/packages/Keyguard/res/values/donottranslate.xml b/packages/Keyguard/res/values/donottranslate.xml index 71d3ed7d5ff9..5ee226b78115 100644 --- a/packages/Keyguard/res/values/donottranslate.xml +++ b/packages/Keyguard/res/values/donottranslate.xml @@ -16,7 +16,5 @@ <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- String matching the lock screen format for displaying the date. --> - <string name="abbrev_wday_month_day_no_year">EEE, MMMM d</string> - <!-- Format for describing the date, for accessibility. --> - <string name="full_wday_month_day_no_year">EEEE, MMMM d</string> + <string name="abbrev_wday_month_day_no_year">EEEMMMMd</string> </resources> diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java index 3e42c14b2f69..57fd82ce901f 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java @@ -17,24 +17,20 @@ package com.android.keyguard; import android.content.Context; -import android.content.res.Resources; -import android.graphics.Typeface; import android.text.TextUtils; +import android.text.format.DateFormat; import android.util.AttributeSet; import android.util.Log; import android.util.Slog; import android.view.View; import android.widget.GridLayout; +import android.widget.TextClock; import android.widget.TextView; import com.android.internal.widget.LockPatternUtils; -import java.text.SimpleDateFormat; -import java.util.Date; import java.util.Locale; -import libcore.icu.ICU; - public class KeyguardStatusView extends GridLayout { private static final boolean DEBUG = KeyguardViewMediator.DEBUG; private static final String TAG = "KeyguardStatusView"; @@ -42,6 +38,7 @@ public class KeyguardStatusView extends GridLayout { private LockPatternUtils mLockPatternUtils; private TextView mAlarmStatusView; + private TextClock mDateView; private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() { @@ -58,10 +55,12 @@ public class KeyguardStatusView extends GridLayout { } }; + @Override public void onScreenTurnedOn() { setEnableMarquee(true); }; + @Override public void onScreenTurnedOff(int why) { setEnableMarquee(false); }; @@ -88,6 +87,7 @@ public class KeyguardStatusView extends GridLayout { protected void onFinishInflate() { super.onFinishInflate(); mAlarmStatusView = (TextView) findViewById(R.id.alarm_status); + mDateView = (TextClock) findViewById(R.id.date_view); mLockPatternUtils = new LockPatternUtils(getContext()); final boolean screenOn = KeyguardUpdateMonitor.getInstance(mContext).isScreenOn(); setEnableMarquee(screenOn); @@ -95,7 +95,11 @@ public class KeyguardStatusView extends GridLayout { } protected void refresh() { - refreshAlarmStatus(); // might as well + final String fmt = DateFormat.getBestDateTimePattern(Locale.getDefault(), + mContext.getResources().getString(R.string.abbrev_wday_month_day_no_year)); + mDateView.setFormat24Hour(fmt); + mDateView.setFormat12Hour(fmt); + refreshAlarmStatus(); } void refreshAlarmStatus() { |