Remove vestigial "Choose date format" option.
Almost all of our date formatting goes via icu these days, so this is
a no-op almost everywhere. (And should be a no-op everywhere soon.)
There's no obvious way to fix it, so remove it. UI guidelines say we
should use spelled out month names anyway.
Bug: 18322220
(cherry picked from commit 30cc30864b
)
Change-Id: I2a84d69a1f21f71d8bce5b69202b07f1b422aa57
This commit is contained in:
@@ -39,15 +39,6 @@
|
||||
<item>All</item>
|
||||
</string-array>
|
||||
|
||||
<!-- There is a setting to control the format of dates displayed throughout the system. This is in the Date & Time Settings screen. These will be adjusted to use punctuation appropriate to the user's locale. -->
|
||||
<string-array name="date_format_values" translatable="false">
|
||||
<!-- The blank item means to use whatever the locale calls for. -->
|
||||
<item></item>
|
||||
<item>MM-dd-yyyy</item>
|
||||
<item>dd-MM-yyyy</item>
|
||||
<item>yyyy-MM-dd</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Display settings. The delay in inactivity before the screen is turned off. These are shown in a list dialog. -->
|
||||
<string-array name="screen_timeout_entries">
|
||||
<item>15 seconds</item>
|
||||
|
@@ -388,12 +388,6 @@
|
||||
<string name="date_and_time">Date & time</string>
|
||||
<!-- The title of the activity to pick a time zone. -->
|
||||
<string name="choose_timezone">Choose time zone</string>
|
||||
<!-- Do not translate. Used as the value for a setting. -->
|
||||
<string name="default_date_format"><xliff:g id="default_date_format">MM/dd/yyyy</xliff:g></string>
|
||||
|
||||
<!-- The option in the date-format picker for using the normal format
|
||||
called for by the user's locale. -->
|
||||
<string name="normal_date_format">Regional (<xliff:g id="date" example="12-31-2009">%s</xliff:g>)</string>
|
||||
|
||||
<!-- Label of preview text when tweaking font size -->
|
||||
<string name="display_preview_label">Preview:</string>
|
||||
@@ -711,10 +705,6 @@
|
||||
<string name="date_time_set_date_title">Date</string>
|
||||
<!-- Date & time setting screen setting option title -->
|
||||
<string name="date_time_set_date">Set date</string>
|
||||
<!-- Date & time setting screen setting option title. This setting allows the user to choose how the date should be displayed in apps (what ordering for month and day, etc.) [CHAR LIMIT=30] -->
|
||||
<string name="date_time_date_format_title">Date format</string>
|
||||
<!-- Date & time setting screen setting option title. This setting allows the user to choose how the date should be displayed in apps (what ordering for month and day, etc.) -->
|
||||
<string name="date_time_date_format">Choose date format</string>
|
||||
<!-- Menu item on Select time zone screen -->
|
||||
<string name="zone_list_menu_sort_alphabetically">Sort alphabetically</string>
|
||||
<!-- Menu item on Select time zone screen -->
|
||||
|
@@ -52,9 +52,4 @@
|
||||
android:title="@string/date_time_24hour"
|
||||
/>
|
||||
|
||||
<ListPreference
|
||||
android:key="date_format"
|
||||
android:title="@string/date_time_date_format"
|
||||
android:summary="mm/dd/yyyy"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
@@ -59,7 +59,6 @@ public class DateTimeSettings extends SettingsPreferenceFragment
|
||||
// The date value is dummy (independent of actual date).
|
||||
private Calendar mDummyDate;
|
||||
|
||||
private static final String KEY_DATE_FORMAT = "date_format";
|
||||
private static final String KEY_AUTO_TIME = "auto_time";
|
||||
private static final String KEY_AUTO_TIME_ZONE = "auto_zone";
|
||||
|
||||
@@ -75,7 +74,6 @@ public class DateTimeSettings extends SettingsPreferenceFragment
|
||||
private SwitchPreference mAutoTimeZonePref;
|
||||
private Preference mTimeZone;
|
||||
private Preference mDatePref;
|
||||
private ListPreference mDateFormat;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -121,41 +119,10 @@ public class DateTimeSettings extends SettingsPreferenceFragment
|
||||
mTime24Pref = findPreference("24 hour");
|
||||
mTimeZone = findPreference("timezone");
|
||||
mDatePref = findPreference("date");
|
||||
mDateFormat = (ListPreference) findPreference(KEY_DATE_FORMAT);
|
||||
if (isFirstRun) {
|
||||
getPreferenceScreen().removePreference(mTime24Pref);
|
||||
getPreferenceScreen().removePreference(mDateFormat);
|
||||
}
|
||||
|
||||
String [] dateFormats = getResources().getStringArray(R.array.date_format_values);
|
||||
String [] formattedDates = new String[dateFormats.length];
|
||||
String currentFormat = getDateFormat();
|
||||
// Initialize if DATE_FORMAT is not set in the system settings
|
||||
// This can happen after a factory reset (or data wipe)
|
||||
if (currentFormat == null) {
|
||||
currentFormat = "";
|
||||
}
|
||||
|
||||
// Prevents duplicated values on date format selector.
|
||||
mDummyDate.set(mDummyDate.get(Calendar.YEAR), mDummyDate.DECEMBER, 31, 13, 0, 0);
|
||||
|
||||
for (int i = 0; i < formattedDates.length; i++) {
|
||||
String formatted =
|
||||
DateFormat.getDateFormatForSetting(getActivity(), dateFormats[i])
|
||||
.format(mDummyDate.getTime());
|
||||
|
||||
if (dateFormats[i].length() == 0) {
|
||||
formattedDates[i] = getResources().
|
||||
getString(R.string.normal_date_format, formatted);
|
||||
} else {
|
||||
formattedDates[i] = formatted;
|
||||
}
|
||||
}
|
||||
|
||||
mDateFormat.setEntries(formattedDates);
|
||||
mDateFormat.setEntryValues(R.array.date_format_values);
|
||||
mDateFormat.setValue(currentFormat);
|
||||
|
||||
mTimePref.setEnabled(!autoTimeEnabled);
|
||||
mDatePref.setEnabled(!autoTimeEnabled);
|
||||
mTimeZone.setEnabled(!autoTimeZoneEnabled);
|
||||
@@ -189,17 +156,15 @@ 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());
|
||||
// We use December 31st because it's unambiguous when demonstrating the date format.
|
||||
// We use 13:00 so we can demonstrate the 12/24 hour options.
|
||||
mDummyDate.set(now.get(Calendar.YEAR), 11, 31, 13, 0, 0);
|
||||
Date dummyDate = mDummyDate.getTime();
|
||||
mDatePref.setSummary(DateFormat.getLongDateFormat(context).format(now.getTime()));
|
||||
mTimePref.setSummary(DateFormat.getTimeFormat(getActivity()).format(now.getTime()));
|
||||
mTimeZone.setSummary(getTimeZoneText(now.getTimeZone(), true));
|
||||
mDatePref.setSummary(shortDateFormat.format(now.getTime()));
|
||||
mDateFormat.setSummary(shortDateFormat.format(dummyDate));
|
||||
mTime24Pref.setSummary(DateFormat.getTimeFormat(getActivity()).format(dummyDate));
|
||||
}
|
||||
|
||||
@@ -227,13 +192,7 @@ public class DateTimeSettings extends SettingsPreferenceFragment
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
||||
if (key.equals(KEY_DATE_FORMAT)) {
|
||||
String format = preferences.getString(key,
|
||||
getResources().getString(R.string.default_date_format));
|
||||
Settings.System.putString(getContentResolver(),
|
||||
Settings.System.DATE_FORMAT, format);
|
||||
updateTimeAndDateDisplay(getActivity());
|
||||
} else if (key.equals(KEY_AUTO_TIME)) {
|
||||
if (key.equals(KEY_AUTO_TIME)) {
|
||||
boolean autoEnabled = preferences.getBoolean(key, true);
|
||||
Settings.Global.putInt(getContentResolver(), Settings.Global.AUTO_TIME,
|
||||
autoEnabled ? 1 : 0);
|
||||
@@ -350,11 +309,6 @@ public class DateTimeSettings extends SettingsPreferenceFragment
|
||||
is24Hour? HOURS_24 : HOURS_12);
|
||||
}
|
||||
|
||||
private String getDateFormat() {
|
||||
return Settings.System.getString(getContentResolver(),
|
||||
Settings.System.DATE_FORMAT);
|
||||
}
|
||||
|
||||
private boolean getAutoState(String name) {
|
||||
try {
|
||||
return Settings.Global.getInt(getContentResolver(), name) > 0;
|
||||
|
@@ -667,33 +667,11 @@ public class BatteryHistoryChart extends View {
|
||||
}
|
||||
|
||||
private boolean isDayFirst() {
|
||||
String value = Settings.System.getString(mContext.getContentResolver(),
|
||||
Settings.System.DATE_FORMAT);
|
||||
if (value == null) {
|
||||
LocaleData d = LocaleData.get(mContext.getResources().getConfiguration().locale);
|
||||
value = d.shortDateFormat4;
|
||||
}
|
||||
LocaleData d = LocaleData.get(mContext.getResources().getConfiguration().locale);
|
||||
String value = d.shortDateFormat4;
|
||||
return value.indexOf('M') > value.indexOf('d');
|
||||
}
|
||||
|
||||
/*
|
||||
private void buildTime() {
|
||||
java.text.DateFormat shortDateFormat = DateFormat.getDateFormat(context);
|
||||
final Calendar now = Calendar.getInstance();
|
||||
mDummyDate.setTimeZone(now.getTimeZone());
|
||||
// We use December 31st because it's unambiguous when demonstrating the date format.
|
||||
// We use 13:00 so we can demonstrate the 12/24 hour options.
|
||||
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(), true));
|
||||
mDatePref.setSummary(shortDateFormat.format(now.getTime()));
|
||||
mDateFormat.setSummary(shortDateFormat.format(dummyDate));
|
||||
mTime24Pref.setSummary(DateFormat.getTimeFormat(getActivity()).format(dummyDate));
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
|
Reference in New Issue
Block a user