Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +9 −4 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C DarkReceiver, ConfigurationListener { DarkReceiver, ConfigurationListener { public static final String CLOCK_SECONDS = "clock_seconds"; public static final String CLOCK_SECONDS = "clock_seconds"; public static final String CLOCK_STYLE = "lineagesystem:status_bar_am_pm"; private boolean mClockVisibleByPolicy = true; private boolean mClockVisibleByPolicy = true; private boolean mClockVisibleByUser = true; private boolean mClockVisibleByUser = true; Loading @@ -78,7 +79,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_SMALL = 1; private static final int AM_PM_STYLE_GONE = 2; 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 final boolean mShowDark; private boolean mShowSeconds; private boolean mShowSeconds; private Handler mSecondsHandler; private Handler mSecondsHandler; Loading @@ -98,7 +99,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C R.styleable.Clock, R.styleable.Clock, 0, 0); 0, 0); try { 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); mShowDark = a.getBoolean(R.styleable.Clock_showDark, true); } finally { } finally { a.recycle(); a.recycle(); Loading @@ -121,7 +122,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C getContext().registerReceiverAsUser(mIntentReceiver, UserHandle.ALL, filter, getContext().registerReceiverAsUser(mIntentReceiver, UserHandle.ALL, filter, null, Dependency.get(Dependency.TIME_TICK_HANDLER)); null, Dependency.get(Dependency.TIME_TICK_HANDLER)); Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS); Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS, CLOCK_STYLE); SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallbacks(this); SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallbacks(this); if (mShowDark) { if (mShowDark) { Dependency.get(DarkIconDispatcher.class).addDarkReceiver(this); Dependency.get(DarkIconDispatcher.class).addDarkReceiver(this); Loading Loading @@ -197,7 +198,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C } } final void updateClock() { final void updateClock() { if (mDemoMode) return; if (mDemoMode || mCalendar == null) return; mCalendar.setTimeInMillis(System.currentTimeMillis()); mCalendar.setTimeInMillis(System.currentTimeMillis()); setText(getSmallTime()); setText(getSmallTime()); setContentDescription(mContentDescriptionFormat.format(mCalendar.getTime())); setContentDescription(mContentDescriptionFormat.format(mCalendar.getTime())); Loading @@ -208,6 +209,10 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C if (CLOCK_SECONDS.equals(key)) { if (CLOCK_SECONDS.equals(key)) { mShowSeconds = newValue != null && Integer.parseInt(newValue) != 0; mShowSeconds = newValue != null && Integer.parseInt(newValue) != 0; updateShowSeconds(); updateShowSeconds(); } else if (CLOCK_STYLE.equals(key)) { mAmPmStyle = newValue == null ? AM_PM_STYLE_GONE : Integer.valueOf(newValue); mClockFormatString = ""; // force refresh updateClock(); } } } } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +9 −4 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C DarkReceiver, ConfigurationListener { DarkReceiver, ConfigurationListener { public static final String CLOCK_SECONDS = "clock_seconds"; public static final String CLOCK_SECONDS = "clock_seconds"; public static final String CLOCK_STYLE = "lineagesystem:status_bar_am_pm"; private boolean mClockVisibleByPolicy = true; private boolean mClockVisibleByPolicy = true; private boolean mClockVisibleByUser = true; private boolean mClockVisibleByUser = true; Loading @@ -78,7 +79,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_SMALL = 1; private static final int AM_PM_STYLE_GONE = 2; 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 final boolean mShowDark; private boolean mShowSeconds; private boolean mShowSeconds; private Handler mSecondsHandler; private Handler mSecondsHandler; Loading @@ -98,7 +99,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C R.styleable.Clock, R.styleable.Clock, 0, 0); 0, 0); try { 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); mShowDark = a.getBoolean(R.styleable.Clock_showDark, true); } finally { } finally { a.recycle(); a.recycle(); Loading @@ -121,7 +122,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C getContext().registerReceiverAsUser(mIntentReceiver, UserHandle.ALL, filter, getContext().registerReceiverAsUser(mIntentReceiver, UserHandle.ALL, filter, null, Dependency.get(Dependency.TIME_TICK_HANDLER)); null, Dependency.get(Dependency.TIME_TICK_HANDLER)); Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS); Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS, CLOCK_STYLE); SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallbacks(this); SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallbacks(this); if (mShowDark) { if (mShowDark) { Dependency.get(DarkIconDispatcher.class).addDarkReceiver(this); Dependency.get(DarkIconDispatcher.class).addDarkReceiver(this); Loading Loading @@ -197,7 +198,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C } } final void updateClock() { final void updateClock() { if (mDemoMode) return; if (mDemoMode || mCalendar == null) return; mCalendar.setTimeInMillis(System.currentTimeMillis()); mCalendar.setTimeInMillis(System.currentTimeMillis()); setText(getSmallTime()); setText(getSmallTime()); setContentDescription(mContentDescriptionFormat.format(mCalendar.getTime())); setContentDescription(mContentDescriptionFormat.format(mCalendar.getTime())); Loading @@ -208,6 +209,10 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C if (CLOCK_SECONDS.equals(key)) { if (CLOCK_SECONDS.equals(key)) { mShowSeconds = newValue != null && Integer.parseInt(newValue) != 0; mShowSeconds = newValue != null && Integer.parseInt(newValue) != 0; updateShowSeconds(); updateShowSeconds(); } else if (CLOCK_STYLE.equals(key)) { mAmPmStyle = newValue == null ? AM_PM_STYLE_GONE : Integer.valueOf(newValue); mClockFormatString = ""; // force refresh updateClock(); } } } } Loading