Skip to content

Commit 43b23c6

Browse files
committed
Flush the clock format when the locale changes.
Bug: 7569120 Change-Id: If85ff36c7fac8b07f10b7077afd23255a145db1c
1 parent bf0e106 commit 43b23c6

File tree

1 file changed

+8
-0
lines changed
  • packages/SystemUI/src/com/android/systemui/statusbar/policy

1 file changed

+8
-0
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
import java.text.SimpleDateFormat;
4242
import java.util.Calendar;
43+
import java.util.Locale;
4344
import java.util.TimeZone;
4445

4546
import com.android.internal.R;
@@ -52,6 +53,7 @@ public class Clock extends TextView {
5253
private Calendar mCalendar;
5354
private String mClockFormatString;
5455
private SimpleDateFormat mClockFormat;
56+
private Locale mLocale;
5557

5658
private static final int AM_PM_STYLE_NORMAL = 0;
5759
private static final int AM_PM_STYLE_SMALL = 1;
@@ -117,6 +119,12 @@ public void onReceive(Context context, Intent intent) {
117119
if (mClockFormat != null) {
118120
mClockFormat.setTimeZone(mCalendar.getTimeZone());
119121
}
122+
} else if (action.equals(Intent.ACTION_CONFIGURATION_CHANGED)) {
123+
final Locale newLocale = getResources().getConfiguration().locale;
124+
if (! newLocale.equals(mLocale)) {
125+
mLocale = newLocale;
126+
mClockFormatString = ""; // force refresh
127+
}
120128
}
121129
updateClock();
122130
}

0 commit comments

Comments
 (0)