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

Commit 239452b0 authored by Isaac Katzenelson's avatar Isaac Katzenelson
Browse files

Clear delete dialog flag when dialog dismissed

Bug: 8167504
Added an onCancel listener to catch cases when closing the dialog
when pressing outside the dialog and resetting the "in delete confirmation"
flag.

Change-Id: I5577924c44affbebdfce32d2153652fb13ba7c0f
parent 7a361eeb
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -67,7 +67,8 @@ import java.util.HashSet;
public class AlarmClock extends Activity implements LoaderManager.LoaderCallbacks<Cursor>,
        AlarmTimePickerDialogFragment.AlarmTimePickerDialogHandler,
        LabelDialogFragment.AlarmLabelDialogHandler,
        OnLongClickListener, Callback, DialogInterface.OnClickListener {
        OnLongClickListener, Callback, DialogInterface.OnClickListener,
        DialogInterface.OnCancelListener {

    private static final String KEY_EXPANDED_IDS = "expandedIds";
    private static final String KEY_REPEAT_CHECKED_IDS = "repeatCheckedIds";
@@ -1267,6 +1268,7 @@ public class AlarmClock extends Activity implements LoaderManager.LoaderCallback
        String msg = String.format(res.getQuantityText(R.plurals.alarm_delete_confirmation,
                mAdapter.getSelectedItemsNum()).toString());
        b.setCancelable(true).setMessage(msg)
                .setOnCancelListener(this)
                .setNegativeButton(res.getString(android.R.string.cancel), this)
                .setPositiveButton(res.getString(android.R.string.ok), this).show();
        mInDeleteConfirmation = true;
@@ -1283,4 +1285,8 @@ public class AlarmClock extends Activity implements LoaderManager.LoaderCallback
        mInDeleteConfirmation = false;
    }

    @Override
    public void onCancel(DialogInterface dialog) {
        mInDeleteConfirmation = false;
    }
}