diff options
author | Beverly <beverlyt@google.com> | 2021-07-02 15:35:41 -0400 |
---|---|---|
committer | Beverly Tai <beverlyt@google.com> | 2021-07-07 20:45:06 +0000 |
commit | 4812dfbc6293b29e9a38909eccea398bee39c7be (patch) | |
tree | afa8cede809c3a866d57592d28043d769c417a6a /packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java | |
parent | 05be67374674da85f6c596ff44a8e4a43aafe742 (diff) |
Bring back time formatting for single line clock
Use old date format for the single line clock, so that we now
support (for single line clock) different clock representations.
For example, French Canadian uses an h instead of a colon
(13 h 01 instead of 13:01).
Test: manual
Bug: 186726401
Fixes: 191761465
Change-Id: If97a49780029f24dc99625a310729630b69e7a68
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java index 781f34bfb195..632919ae51e4 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java @@ -20,9 +20,7 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import android.app.WallpaperManager; -import android.content.res.Resources; import android.text.TextUtils; -import android.text.format.DateFormat; import android.view.View; import android.widget.FrameLayout; import android.widget.RelativeLayout; @@ -367,37 +365,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS return mColorExtractor.getColors(WallpaperManager.FLAG_LOCK); } - // DateFormat.getBestDateTimePattern is extremely expensive, and refresh is called often. - // This is an optimization to ensure we only recompute the patterns when the inputs change. - private static final class Patterns { - static String sClockView12; - static String sClockView24; - static String sCacheKey; - - static void update(Resources res) { - final Locale locale = Locale.getDefault(); - final String clockView12Skel = res.getString(R.string.clock_12hr_format); - final String clockView24Skel = res.getString(R.string.clock_24hr_format); - final String key = locale.toString() + clockView12Skel + clockView24Skel; - if (key.equals(sCacheKey)) return; - - sClockView12 = DateFormat.getBestDateTimePattern(locale, clockView12Skel); - // CLDR insists on adding an AM/PM indicator even though it wasn't in the skeleton - // format. The following code removes the AM/PM indicator if we didn't want it. - if (!clockView12Skel.contains("a")) { - sClockView12 = sClockView12.replaceAll("a", "").trim(); - } - - sClockView24 = DateFormat.getBestDateTimePattern(locale, clockView24Skel); - - // Use fancy colon. - sClockView24 = sClockView24.replace(':', '\uee01'); - sClockView12 = sClockView12.replace(':', '\uee01'); - - sCacheKey = key; - } - } - private int getCurrentLayoutDirection() { return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()); } |