Change dummy calendar setting during locale change

If the timezone changed too far, the example date would be "1/1/yyyy+1"
instead of "12/31/yyyy"

Move the setting of the Calendar time to where the string is calculated
to make sure we have the most up-to-date Locale.

Bug: 4596841
Change-Id: I67a253a65b1ea03ee717945c5df819beb8515662
This commit is contained in:
Kenny Root
2011-06-12 19:44:14 -07:00
parent 8a50364a71
commit 151b0e1174

View File

@@ -88,7 +88,6 @@ public class DateTimeSettings extends SettingsPreferenceFragment
boolean isFirstRun = intent.getBooleanExtra(EXTRA_IS_FIRST_RUN, false);
mDummyDate = Calendar.getInstance();
mDummyDate.set(mDummyDate.get(Calendar.YEAR), 11, 31, 13, 0, 0);
mAutoTimePref = (CheckBoxPreference) findPreference(KEY_AUTO_TIME);
mAutoTimePref.setChecked(autoTimeEnabled);
@@ -171,6 +170,8 @@ public class DateTimeSettings extends SettingsPreferenceFragment
public void updateTimeAndDateDisplay(Context context) {
java.text.DateFormat shortDateFormat = DateFormat.getDateFormat(context);
final Calendar now = Calendar.getInstance();
mDummyDate.setTimeZone(now.getTimeZone());
mDummyDate.set(now.get(Calendar.YEAR), 11, 31, 13, 0, 0);
Date dummyDate = mDummyDate.getTime();
mTimePref.setSummary(DateFormat.getTimeFormat(getActivity()).format(now.getTime()));
mTimeZone.setSummary(getTimeZoneText(now.getTimeZone()));