diff options
| author | Craig Stout <cstout@google.com> | 2014-07-17 11:32:09 -0700 |
|---|---|---|
| committer | Craig Stout <cstout@google.com> | 2014-07-17 23:28:48 +0000 |
| commit | abdd154334eced2595d42e17a9dbac242a9af7da (patch) | |
| tree | 87e5734af1c54b8f97e1be14f837b3ba8e5f5402 /core/java/android/app/TimePickerDialog.java | |
| parent | 0048da2114b54357e4901f40930afc7d503e0e24 (diff) | |
Fix timepicker double done buttons.
Leanback theme uses a legacy layout with a done button, but
apps won't necessarily have target apilevel L.
Change-Id: Ib38b08df1fe07bd8fb4e64e93633ce0b7eb12567
Diffstat (limited to 'core/java/android/app/TimePickerDialog.java')
| -rw-r--r-- | core/java/android/app/TimePickerDialog.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/app/TimePickerDialog.java b/core/java/android/app/TimePickerDialog.java index ff2a1740ca77..a2f30508c387 100644 --- a/core/java/android/app/TimePickerDialog.java +++ b/core/java/android/app/TimePickerDialog.java @@ -113,7 +113,6 @@ public class TimePickerDialog extends AlertDialog if (targetSdkVersion < Build.VERSION_CODES.L) { setIcon(0); setTitle(R.string.time_picker_dialog_title); - setButton(BUTTON_POSITIVE, themeContext.getText(R.string.date_time_done), this); } final LayoutInflater inflater = LayoutInflater.from(themeContext); @@ -122,6 +121,11 @@ public class TimePickerDialog extends AlertDialog mTimePicker = (TimePicker) view.findViewById(R.id.timePicker); mTimePicker.setShowDoneButton(true); + // If time picker layout has no done button, add a dialog button. + if (!mTimePicker.isShowDoneButton()) { + setButton(BUTTON_POSITIVE, themeContext.getText(R.string.date_time_done), this); + } + mTimePicker.setDismissCallback(new TimePicker.TimePickerDismissCallback() { @Override public void dismiss(TimePicker view, boolean isCancel, int hourOfDay, int minute) { |
