Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +14 −3 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.text.format.DateFormat; import android.text.style.CharacterStyle; import android.text.style.RelativeSizeSpan; import android.util.AttributeSet; import android.util.Log; import android.view.Display; import android.view.View; import android.widget.TextView; Loading Loading @@ -67,6 +68,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C DarkReceiver, ConfigurationListener { public static final String CLOCK_SECONDS = "clock_seconds"; private static final String TAG = "StatusBarClock"; 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 Loading @@ -228,9 +230,18 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Handler handler = getHandler(); if (handler == null) { Log.e(TAG, "Received intent, but handler is null - still attached to window? Window " + "token: " + getWindowToken()); return; } if (action.equals(Intent.ACTION_TIMEZONE_CHANGED)) { String tz = intent.getStringExtra("time-zone"); getHandler().post(() -> { handler.post(() -> { mCalendar = Calendar.getInstance(TimeZone.getTimeZone(tz)); if (mClockFormat != null) { mClockFormat.setTimeZone(mCalendar.getTimeZone()); Loading @@ -238,14 +249,14 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C }); } else if (action.equals(Intent.ACTION_CONFIGURATION_CHANGED)) { final Locale newLocale = getResources().getConfiguration().locale; getHandler().post(() -> { handler.post(() -> { if (!newLocale.equals(mLocale)) { mLocale = newLocale; mClockFormatString = ""; // force refresh } }); } getHandler().post(() -> updateClock()); handler.post(() -> updateClock()); } }; Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +14 −3 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.text.format.DateFormat; import android.text.style.CharacterStyle; import android.text.style.RelativeSizeSpan; import android.util.AttributeSet; import android.util.Log; import android.view.Display; import android.view.View; import android.widget.TextView; Loading Loading @@ -67,6 +68,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C DarkReceiver, ConfigurationListener { public static final String CLOCK_SECONDS = "clock_seconds"; private static final String TAG = "StatusBarClock"; 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 Loading @@ -228,9 +230,18 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Handler handler = getHandler(); if (handler == null) { Log.e(TAG, "Received intent, but handler is null - still attached to window? Window " + "token: " + getWindowToken()); return; } if (action.equals(Intent.ACTION_TIMEZONE_CHANGED)) { String tz = intent.getStringExtra("time-zone"); getHandler().post(() -> { handler.post(() -> { mCalendar = Calendar.getInstance(TimeZone.getTimeZone(tz)); if (mClockFormat != null) { mClockFormat.setTimeZone(mCalendar.getTimeZone()); Loading @@ -238,14 +249,14 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C }); } else if (action.equals(Intent.ACTION_CONFIGURATION_CHANGED)) { final Locale newLocale = getResources().getConfiguration().locale; getHandler().post(() -> { handler.post(() -> { if (!newLocale.equals(mLocale)) { mLocale = newLocale; mClockFormatString = ""; // force refresh } }); } getHandler().post(() -> updateClock()); handler.post(() -> updateClock()); } }; Loading