Merge "Use CLDR narrow am/pm markers." into lmp-dev
diff --git a/core/java/android/widget/TimePickerClockDelegate.java b/core/java/android/widget/TimePickerClockDelegate.java
index 1b89179..ae44047 100644
--- a/core/java/android/widget/TimePickerClockDelegate.java
+++ b/core/java/android/widget/TimePickerClockDelegate.java
@@ -37,6 +37,8 @@
import java.util.Calendar;
import java.util.Locale;
+import libcore.icu.LocaleData;
+
import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_AUTO;
import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES;
@@ -143,11 +145,8 @@
mMinuteSpinnerInput = (EditText) mMinuteSpinner.findViewById(R.id.numberpicker_input);
mMinuteSpinnerInput.setImeOptions(EditorInfo.IME_ACTION_NEXT);
- /* Get the localized am/pm strings and use them in the spinner */
- final Resources res = context.getResources();
- final String amText = res.getString(R.string.time_picker_am_label);
- final String pmText = res.getString(R.string.time_picker_pm_label);
- mAmPmStrings = new String[] {amText, pmText};
+ // Get the localized am/pm strings and use them in the spinner.
+ mAmPmStrings = getAmPmStrings(context);
// am/pm
View amPmView = mDelegator.findViewById(R.id.amPm);
@@ -601,5 +600,12 @@
}
};
}
-}
+ public static String[] getAmPmStrings(Context context) {
+ String[] result = new String[2];
+ LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);
+ result[0] = d.amPm[0].length() > 2 ? d.narrowAm : d.amPm[0];
+ result[1] = d.amPm[1].length() > 2 ? d.narrowPm : d.amPm[1];
+ return result;
+ }
+}
diff --git a/core/java/android/widget/TimePickerSpinnerDelegate.java b/core/java/android/widget/TimePickerSpinnerDelegate.java
index 9a50250..dd1bf4f 100644
--- a/core/java/android/widget/TimePickerSpinnerDelegate.java
+++ b/core/java/android/widget/TimePickerSpinnerDelegate.java
@@ -127,8 +127,10 @@
mSelectHours = res.getString(R.string.select_hours);
mMinutePickerDescription = res.getString(R.string.minute_picker_description);
mSelectMinutes = res.getString(R.string.select_minutes);
- mAmText = res.getString(R.string.time_picker_am_label);
- mPmText = res.getString(R.string.time_picker_pm_label);
+
+ String[] amPmStrings = TimePickerClockDelegate.getAmPmStrings(context);
+ mAmText = amPmStrings[0];
+ mPmText = amPmStrings[1];
final int layoutResourceId = a.getResourceId(R.styleable.TimePicker_internalLayout,
R.layout.time_picker_holo);
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 1453e15..a7f147f 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4142,10 +4142,6 @@
<string name="time_picker_increment_set_pm_button">Set PM</string>
<!-- Description of the button to decrease the TimePicker's set AM value. [CHAR LIMIT=NONE] -->
<string name="time_picker_decrement_set_am_button">Set AM</string>
- <!-- Label for the TimePicker's PM button. [CHAR LIMIT=2] -->
- <string name="time_picker_pm_label">PM</string>
- <!-- Label for the TimePicker's AM button. [CHAR LIMIT=2] -->
- <string name="time_picker_am_label">AM</string>
<!-- DatePicker - accessibility support -->
<!-- Description of the button to increase the DatePicker's month value. [CHAR LIMIT=NONE] -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index b5ec56a..cdaa887 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1985,8 +1985,6 @@
<java-symbol type="attr" name="headerSelectedTextColor" />
<java-symbol type="attr" name="amPmSelectedBackgroundColor" />
<java-symbol type="bool" name="config_sms_decode_gsm_8bit_data" />
- <java-symbol type="string" name="time_picker_am_label" />
- <java-symbol type="string" name="time_picker_pm_label" />
<java-symbol type="dimen" name="text_size_small_material" />
<java-symbol type="attr" name="checkMarkGravity" />
<java-symbol type="layout" name="select_dialog_singlechoice_material" />