Settings: Ensure zen day-of-week formats use current locale.

Don't share SimpleDateFormat instances per-process, convert to
per-instance to ensure we're always using the current locale.

Updated version of:
  https://android-review.googlesource.com/#/c/147246/

Change-Id: Id464c35035c1de0a7894e5e19b57934f77df9769
This commit is contained in:
John Spurlock
2015-04-23 20:28:58 -04:00
parent 1049f4d81b
commit 4f8d4f0d2b
3 changed files with 10 additions and 7 deletions

View File

@@ -50,10 +50,11 @@ public class ZenModeScheduleRuleSettings extends ZenModeRuleSettingsBase {
private static final String KEY_START_TIME = "start_time";
private static final String KEY_END_TIME = "end_time";
private static final SimpleDateFormat DAY_FORMAT = new SimpleDateFormat("EEE");
public static final String ACTION = Settings.ACTION_ZEN_MODE_SCHEDULE_RULE_SETTINGS;
// per-instance to ensure we're always using the current locale
private final SimpleDateFormat mDayFormat = new SimpleDateFormat("EEE");
private Preference mDays;
private TimePickerPreference mStart;
private TimePickerPreference mEnd;
@@ -147,7 +148,7 @@ public class ZenModeScheduleRuleSettings extends ZenModeRuleSettingsBase {
if (sb.length() > 0) {
sb.append(mContext.getString(R.string.summary_divider_text));
}
sb.append(DAY_FORMAT.format(c.getTime()));
sb.append(mDayFormat.format(c.getTime()));
break;
}
}