diff options
| author | David Ogutu <ogutu@google.com> | 2018-02-05 17:08:11 -0500 |
|---|---|---|
| committer | David Ogutu <ogutu@google.com> | 2018-02-06 09:22:20 -0500 |
| commit | 93ac6d01bb8c086aeb77daf862e0478ad8a0ccb3 (patch) | |
| tree | 180aa22f470506ffb84dc0b897cbec4ce0153961 /core/java/android/widget/TextInputTimePickerView.java | |
| parent | 348f19e6a3baccd76056e1d4cc264e23bacd8223 (diff) | |
Fix TimePicker keyboard UI num digits for min
Force the minutes to always format to 2 digits. This is a temporary fix
that's not quite fully Locale aware but fixes UI issue. Will need to
refactor code to seperate Locale info, share code with non-keyboard UI
and use more native Locale functions to determine number of digits.
Test: Manual https://drive.google.com/file/d/1iabh2Zzl0YRhj17gbVKr8GvVDXEHUnWI/view?usp=sharing
Bug: 72041032
Change-Id: I0eb479b9aece4726db7bf7fba04dc50ad0f175c5
Diffstat (limited to 'core/java/android/widget/TextInputTimePickerView.java')
| -rw-r--r-- | core/java/android/widget/TextInputTimePickerView.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/java/android/widget/TextInputTimePickerView.java b/core/java/android/widget/TextInputTimePickerView.java index 0cf8faad1c57..e0261ad04f58 100644 --- a/core/java/android/widget/TextInputTimePickerView.java +++ b/core/java/android/widget/TextInputTimePickerView.java @@ -174,7 +174,8 @@ public class TextInputTimePickerView extends RelativeLayout { */ void updateTextInputValues(int localizedHour, int minute, int amOrPm, boolean is24Hour, boolean hourFormatStartsAtZero) { - final String format = "%d"; + final String hourFormat = "%d"; + final String minuteFormat = "%02d"; mIs24Hour = is24Hour; mHourFormatStartsAtZero = hourFormatStartsAtZero; @@ -187,8 +188,8 @@ public class TextInputTimePickerView extends RelativeLayout { mAmPmSpinner.setSelection(1); } - mHourEditText.setText(String.format(format, localizedHour)); - mMinuteEditText.setText(String.format(format, minute)); + mHourEditText.setText(String.format(hourFormat, localizedHour)); + mMinuteEditText.setText(String.format(minuteFormat, minute)); if (mErrorShowing) { validateInput(); |
