Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +12 −4 Original line number Diff line number Diff line Loading @@ -54,6 +54,8 @@ import com.android.systemui.tuner.TunerService.Tunable; import libcore.icu.LocaleData; import lineageos.providers.LineageSettings; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; Loading @@ -66,6 +68,8 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C DarkReceiver, ConfigurationListener { public static final String CLOCK_SECONDS = "clock_seconds"; private static final String CLOCK_STYLE = "lineagesystem:" + LineageSettings.System.STATUS_BAR_AM_PM; private static final String CLOCK_SUPER_PARCELABLE = "clock_super_parcelable"; private static final String CURRENT_USER_ID = "current_user_id"; private static final String VISIBLE_BY_POLICY = "visible_by_policy"; Loading @@ -91,7 +95,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C private static final int AM_PM_STYLE_SMALL = 1; private static final int AM_PM_STYLE_GONE = 2; private final int mAmPmStyle; private int mAmPmStyle = AM_PM_STYLE_GONE; private final boolean mShowDark; private boolean mShowSeconds; private Handler mSecondsHandler; Loading Loading @@ -121,7 +125,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C R.styleable.Clock, 0, 0); try { mAmPmStyle = a.getInt(R.styleable.Clock_amPmStyle, AM_PM_STYLE_GONE); mAmPmStyle = a.getInt(R.styleable.Clock_amPmStyle, mAmPmStyle); mShowDark = a.getBoolean(R.styleable.Clock_showDark, true); mNonAdaptedColor = getCurrentTextColor(); } finally { Loading Loading @@ -189,7 +193,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C // The receiver will return immediately if the view does not have a Handler yet. mBroadcastDispatcher.registerReceiverWithHandler(mIntentReceiver, filter, Dependency.get(Dependency.TIME_TICK_HANDLER), UserHandle.ALL); Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS); Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS, CLOCK_STYLE); mCommandQueue.addCallback(this); if (mShowDark) { Dependency.get(DarkIconDispatcher.class).addDarkReceiver(this); Loading Loading @@ -284,7 +288,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C } final void updateClock() { if (mDemoMode) return; if (mDemoMode || mCalendar == null) return; mCalendar.setTimeInMillis(System.currentTimeMillis()); setText(getSmallTime()); setContentDescription(mContentDescriptionFormat.format(mCalendar.getTime())); Loading @@ -295,6 +299,10 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C if (CLOCK_SECONDS.equals(key)) { mShowSeconds = TunerService.parseIntegerSwitch(newValue, false); updateShowSeconds(); } else if (CLOCK_STYLE.equals(key)) { mAmPmStyle = TunerService.parseInteger(newValue, AM_PM_STYLE_GONE); mClockFormatString = ""; // force refresh updateClock(); } } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +12 −4 Original line number Diff line number Diff line Loading @@ -54,6 +54,8 @@ import com.android.systemui.tuner.TunerService.Tunable; import libcore.icu.LocaleData; import lineageos.providers.LineageSettings; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; Loading @@ -66,6 +68,8 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C DarkReceiver, ConfigurationListener { public static final String CLOCK_SECONDS = "clock_seconds"; private static final String CLOCK_STYLE = "lineagesystem:" + LineageSettings.System.STATUS_BAR_AM_PM; private static final String CLOCK_SUPER_PARCELABLE = "clock_super_parcelable"; private static final String CURRENT_USER_ID = "current_user_id"; private static final String VISIBLE_BY_POLICY = "visible_by_policy"; Loading @@ -91,7 +95,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C private static final int AM_PM_STYLE_SMALL = 1; private static final int AM_PM_STYLE_GONE = 2; private final int mAmPmStyle; private int mAmPmStyle = AM_PM_STYLE_GONE; private final boolean mShowDark; private boolean mShowSeconds; private Handler mSecondsHandler; Loading Loading @@ -121,7 +125,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C R.styleable.Clock, 0, 0); try { mAmPmStyle = a.getInt(R.styleable.Clock_amPmStyle, AM_PM_STYLE_GONE); mAmPmStyle = a.getInt(R.styleable.Clock_amPmStyle, mAmPmStyle); mShowDark = a.getBoolean(R.styleable.Clock_showDark, true); mNonAdaptedColor = getCurrentTextColor(); } finally { Loading Loading @@ -189,7 +193,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C // The receiver will return immediately if the view does not have a Handler yet. mBroadcastDispatcher.registerReceiverWithHandler(mIntentReceiver, filter, Dependency.get(Dependency.TIME_TICK_HANDLER), UserHandle.ALL); Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS); Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS, CLOCK_STYLE); mCommandQueue.addCallback(this); if (mShowDark) { Dependency.get(DarkIconDispatcher.class).addDarkReceiver(this); Loading Loading @@ -284,7 +288,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C } final void updateClock() { if (mDemoMode) return; if (mDemoMode || mCalendar == null) return; mCalendar.setTimeInMillis(System.currentTimeMillis()); setText(getSmallTime()); setContentDescription(mContentDescriptionFormat.format(mCalendar.getTime())); Loading @@ -295,6 +299,10 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C if (CLOCK_SECONDS.equals(key)) { mShowSeconds = TunerService.parseIntegerSwitch(newValue, false); updateShowSeconds(); } else if (CLOCK_STYLE.equals(key)) { mAmPmStyle = TunerService.parseInteger(newValue, AM_PM_STYLE_GONE); mClockFormatString = ""; // force refresh updateClock(); } } Loading