Commit 03a27b81 authored by Narayan Kamath's avatar Narayan Kamath
Browse files

Remove "date format" setting from TvSettings.

bug: 18322220
Change-Id: I2aa49c57b232bab55204383aba34bb329da516ad
parent 784d29c7
......@@ -581,8 +581,6 @@
<string name="system_time">Time</string>
<!-- Title for Set Date in System Settings Date Time [CHAR LIMIT=50] -->
<string name="system_set_date">Set date</string>
<!-- Title for Set date format in System Settings Date Time [CHAR LIMIT=50] -->
<string name="system_choose_date_format">Choose date format</string>
<!-- Title for Set Time in System Settings Date Time [CHAR LIMIT=50] -->
<string name="system_set_time">Set time</string>
<!-- Title for Set Time Zone in System Settings Date Time [CHAR LIMIT=50] -->
......@@ -861,14 +859,6 @@
<!-- Description for profile GPU rendering in System Settings Developer options [CHAR LIMIT=100] -->
<string name="system_desc_profile_gpu_rendering">Measure rendering time in adb shell dumpsys gfxinfo</string>
<!-- 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>
<!-- 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>
......
......@@ -41,7 +41,6 @@ enum ActionType {
DATE(R.string.system_date),
TIME(R.string.system_time),
DATE_SET_DATE(R.string.system_set_date),
DATE_CHOOSE_FORMAT(R.string.system_choose_date_format),
TIME_SET_TIME(R.string.system_set_time),
TIME_SET_TIME_ZONE(R.string.system_set_time_zone),
TIME_CHOOSE_FORMAT(R.string.system_set_time_format),
......
......@@ -43,9 +43,7 @@ import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.View;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
......@@ -164,36 +162,10 @@ public class DateTimeActivity extends BaseSettingsActivity implements ActionAdap
}
}
private String[] getFormattedDates() {
String[] dateFormats = getResources().getStringArray(R.array.date_format_values);
String[] formattedDates = new String[dateFormats.length];
for (int i = 0; i < formattedDates.length; i++) {
String formatted = DateFormat.getDateFormatForSetting(this, dateFormats[i])
.format(mDummyDate.getTime());
if (dateFormats[i].length() == 0) {
formattedDates[i] = getString(R.string.normal_date_format, formatted);
} else {
formattedDates[i] = formatted;
}
}
return formattedDates;
}
private boolean isTimeFormat24h() {
return DateFormat.is24HourFormat(this);
}
private String getDateFormat() {
return Settings.System.getString(getContentResolver(),
Settings.System.DATE_FORMAT);
}
private void setDateFormat(String s) {
Settings.System.putString(getContentResolver(), Settings.System.DATE_FORMAT, s);
}
private void setTime24Hour(boolean is24Hour) {
Settings.System.putString(getContentResolver(),
Settings.System.TIME_12_24,
......@@ -238,11 +210,6 @@ public class DateTimeActivity extends BaseSettingsActivity implements ActionAdap
*/
final String key = action.getKey();
switch ((ActionType) mState) {
case DATE_CHOOSE_FORMAT:
setDateFormat(key);
updateTimeAndDateStrings();
goBack();
return;
case TIME_SET_TIME_ZONE:
setTimeZone(key);
updateTimeAndDateStrings();
......@@ -264,7 +231,6 @@ public class DateTimeActivity extends BaseSettingsActivity implements ActionAdap
switch (type) {
case DATE:
case TIME:
case DATE_CHOOSE_FORMAT:
case TIME_CHOOSE_FORMAT:
case DATE_SET_DATE:
case TIME_SET_TIME:
......@@ -302,22 +268,6 @@ public class DateTimeActivity extends BaseSettingsActivity implements ActionAdap
return ActionType.DATE_TIME_OVERVIEW;
}
private String getDateFormatExampleString() {
// Display a default example date.
// TODO: Check with UX on exactly what we should display here, a sample date
// or a standard (but localized) format descriptor.
String setFormat = getDateFormat();
String formatted = DateFormat.getDateFormatForSetting(this, getDateFormat())
.format(mDummyDate.getTime());
String displayText;
if (setFormat == null || setFormat.isEmpty()) {
displayText = getString(R.string.normal_date_format, formatted);
} else {
displayText = formatted;
}
return displayText;
}
// Updates the Date and Time entries in the current view, without resetting the
// Action fragment, so we don't trigger an animation.
protected void updateTimeAndDateDisplay() {
......@@ -339,8 +289,6 @@ public class DateTimeActivity extends BaseSettingsActivity implements ActionAdap
break;
case DATE:
mActions.add(ActionType.DATE_SET_DATE.toAction(mResources, mNowDate));
mActions.add(ActionType.DATE_CHOOSE_FORMAT.toAction(mResources,
getDateFormatExampleString()));
break;
case TIME:
mActions.add(ActionType.TIME_SET_TIME.toAction(mResources, mNowTime));
......@@ -372,9 +320,6 @@ public class DateTimeActivity extends BaseSettingsActivity implements ActionAdap
break;
case DATE:
mActions.add(ActionType.DATE_SET_DATE.toAction(mResources, mNowDate, !autoTime));
mActions.add(ActionType.DATE_CHOOSE_FORMAT.toAction(mResources,
getDateFormatExampleString()));
break;
case TIME:
mActions.add(ActionType.TIME_SET_TIME.toAction(mResources, mNowTime, !autoTime));
......@@ -383,14 +328,6 @@ public class DateTimeActivity extends BaseSettingsActivity implements ActionAdap
mActions.add(ActionType.TIME_CHOOSE_FORMAT.toAction(
mResources, getTimeFormatDescription()));
break;
case DATE_CHOOSE_FORMAT:
String[] formats = mResources.getStringArray(R.array.date_format_values);
String currentFormat = getDateFormat();
mActions = Action.createActionsFromArrays(formats, getFormattedDates());
for (Action action : mActions) {
action.setChecked(action.getKey().equalsIgnoreCase(currentFormat));
}
break;
case TIME_CHOOSE_FORMAT:
mActions.add(ActionBehavior.ON.toAction(ActionBehavior.getOnKey(
ActionType.TIME_CHOOSE_FORMAT.name()), mResources, isTimeFormat24h()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment