Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a28a097 authored by Aurimas Liutikas's avatar Aurimas Liutikas
Browse files

Restore TimePickerDialog#onClick behavior.

onClick used to dismiss the dialog recording the set time.
In ag/1831151 I removed handling of BUTTON_POSITIVE as the button
clicks were now handled via click listener set in show(). However,
onClick can be also called programatically and not just via clicking
the button. This CL restores that behavior. It will skip validation
and use the last valid hour and minute.

Bug: 36037351
Test: TimePickerDialogTest#testOnClick now passes
Change-Id: I15952dadab0c7b73ae5fecb1539edf5ebddec68c
parent 41eae911
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -164,6 +164,15 @@ public class TimePickerDialog extends AlertDialog implements OnClickListener,
    @Override
    public void onClick(DialogInterface dialog, int which) {
        switch (which) {
            case BUTTON_POSITIVE:
                // Note this skips input validation and just uses the last valid time and hour
                // entry. This will only be invoked programmatically. User clicks on BUTTON_POSITIVE
                // are handled in show().
                if (mTimeSetListener != null) {
                    mTimeSetListener.onTimeSet(mTimePicker, mTimePicker.getCurrentHour(),
                            mTimePicker.getCurrentMinute());
                }
                break;
            case BUTTON_NEGATIVE:
                cancel();
                break;