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

Commit a892df45 authored by Josep del Río's avatar Josep del Río Committed by Android (Google) Code Review
Browse files

Merge "Close dialogs and activity on Escape down" into main

parents 394de119 4601313a
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -3927,6 +3927,7 @@ public class Activity extends ContextThemeWrapper

        if (keyCode == KeyEvent.KEYCODE_ESCAPE && mWindow.shouldCloseOnTouchOutside()) {
            event.startTracking();
            finish();
            return true;
        }

@@ -4027,10 +4028,7 @@ public class Activity extends ContextThemeWrapper
        }

        if (keyCode == KeyEvent.KEYCODE_ESCAPE
                && mWindow.shouldCloseOnTouchOutside()
                && event.isTracking()
                && !event.isCanceled()) {
            finish();
                && event.isTracking()) {
            return true;
        }

+10 −6
Original line number Diff line number Diff line
@@ -672,7 +672,16 @@ public class Dialog implements DialogInterface, Window.Callback,
     */
    @Override
    public boolean onKeyDown(int keyCode, @NonNull KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            event.startTracking();
            return true;
        }
        if (keyCode == KeyEvent.KEYCODE_ESCAPE) {
            if (mCancelable) {
                cancel();
            } else {
                dismiss();
            }
            event.startTracking();
            return true;
        }
@@ -712,11 +721,6 @@ public class Dialog implements DialogInterface, Window.Callback,
                    }
                    break;
                case KeyEvent.KEYCODE_ESCAPE:
                    if (mCancelable) {
                        cancel();
                    } else {
                        dismiss();
                    }
                    return true;
            }
        }