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

Commit 278387fb authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix bug #16309454 Broken recent button after dismissing set time dialog

- correct set and use the Canceled state

Change-Id: Id60ae14c493254193ee677b66388a64a49618273
parent 61a5a3f2
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ public class TimePickerDialog extends AlertDialog
    int mInitialMinute;
    boolean mIs24HourView;

    private boolean mIsCanceled;

    /**
     * @param context Parent.
     * @param callBack How parent is notified.
@@ -124,10 +126,13 @@ public class TimePickerDialog extends AlertDialog
        mTimePicker.setDismissCallback(new TimePicker.TimePickerDismissCallback() {
            @Override
            public void dismiss(TimePicker view, boolean isCancel, int hourOfDay, int minute) {
                mIsCanceled = isCancel;
                if (!isCancel) {
                    mTimeSetCallback.onTimeSet(view, hourOfDay, minute);
                }
                    TimePickerDialog.this.dismiss();
                } else {
                    TimePickerDialog.this.cancel();
                }
            }
        });
        mTimePicker.setIs24HourView(mIs24HourView);
@@ -150,7 +155,7 @@ public class TimePickerDialog extends AlertDialog
    }

    private void tryNotifyTimeSet() {
        if (mTimeSetCallback != null) {
        if (mTimeSetCallback != null && !mIsCanceled) {
            mTimePicker.clearFocus();
            mTimeSetCallback.onTimeSet(mTimePicker, mTimePicker.getCurrentHour(),
                    mTimePicker.getCurrentMinute());