diff options
author | Elliott Hughes <enh@google.com> | 2014-08-22 23:02:13 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-22 23:02:14 +0000 |
commit | ed402566707e1910145a289929185a19b4dc38a5 (patch) | |
tree | e695b4b64065422663e3891c384a64421ad33fa7 /core/java/android/widget | |
parent | 7653a30ea0232ab8323ec51ddcba8d8054ca8a2f (diff) | |
parent | 1cc51a6c6c656c6ef0a0e57f2acd6f6d82f17bd9 (diff) | |
download | frameworks_base-ed402566707e1910145a289929185a19b4dc38a5.zip frameworks_base-ed402566707e1910145a289929185a19b4dc38a5.tar.gz frameworks_base-ed402566707e1910145a289929185a19b4dc38a5.tar.bz2 |
Merge "Use CLDR narrow am/pm markers." into lmp-dev
Diffstat (limited to 'core/java/android/widget')
-rw-r--r-- | core/java/android/widget/TimePickerClockDelegate.java | 18 | ||||
-rw-r--r-- | core/java/android/widget/TimePickerSpinnerDelegate.java | 6 |
2 files changed, 16 insertions, 8 deletions
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 com.android.internal.R; 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 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate { 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 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate { } }; } -} + 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 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im 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); |