Skip to content

Commit 11c9132

Browse files
committed
TimePicker CTS test failing.
TimePicker code for setting the IME options was not taking into account the old style of the UI where the AmPm spinner can be null. bug:5318844 Change-Id: I58b1781ef95398d11ecf0ca5bb49817cbba97b54
1 parent cb18db8 commit 11c9132

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

core/java/android/widget/TimePicker.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
218218
updateAmPmControl();
219219
}
220220
});
221+
EditText amPmInput = (EditText) mAmPmSpinner.findViewById(R.id.numberpicker_input);
222+
amPmInput.setImeOptions(EditorInfo.IME_ACTION_DONE);
221223
}
222-
EditText amPmInput = (EditText) mAmPmSpinner.findViewById(R.id.numberpicker_input);
223-
amPmInput.setImeOptions(EditorInfo.IME_ACTION_DONE);
224224

225225
// update controls to initial state
226226
updateHourControl();
@@ -519,9 +519,11 @@ private void setContentDescriptions() {
519519
text = mContext.getString(R.string.time_picker_decrement_hour_button);
520520
mHourSpinner.findViewById(R.id.decrement).setContentDescription(text);
521521
// AM/PM
522-
text = mContext.getString(R.string.time_picker_increment_set_pm_button);
523-
mAmPmSpinner.findViewById(R.id.increment).setContentDescription(text);
524-
text = mContext.getString(R.string.time_picker_decrement_set_am_button);
525-
mAmPmSpinner.findViewById(R.id.decrement).setContentDescription(text);
522+
if (mAmPmSpinner != null) {
523+
text = mContext.getString(R.string.time_picker_increment_set_pm_button);
524+
mAmPmSpinner.findViewById(R.id.increment).setContentDescription(text);
525+
text = mContext.getString(R.string.time_picker_decrement_set_am_button);
526+
mAmPmSpinner.findViewById(R.id.decrement).setContentDescription(text);
527+
}
526528
}
527529
}

0 commit comments

Comments
 (0)