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

Commit 8e5992ad authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "New dialog assets. Cancelable AlertDialogs may now be canceled by tapping outside."

parents fb0c3aa5 fc94ddef
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.util.Log;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
@@ -81,6 +82,24 @@ public class AlertDialog extends Dialog implements DialogInterface {
        return outValue.resourceId;
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        if (mCancelable) {
            final View decor = mWindow.getDecorView();
            final int width = decor.getWidth();
            final int height = decor.getHeight();
            final float x = ev.getX();
            final float y = ev.getY();

            if (mCancelable && (x < 0 || x > width || y < 0 || y > height)) {
                cancel();
                return true;
            }
        }

        return super.onTouchEvent(ev);
    }

    /**
     * Gets one of the buttons used in the dialog.
     * <p>
+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ public class ButtonGroup extends LinearLayout {

    @Override
    public void addView(View child, int index, ViewGroup.LayoutParams params) {
        if (mButtonBackgroundRes != 0) {
        if (child instanceof Button && mButtonBackgroundRes != 0) {
            // Preserve original padding as we change the background
            final int paddingLeft = child.getPaddingLeft();
            final int paddingRight = child.getPaddingRight();
+1.63 KiB (4.83 KiB)
Loading image diff...
+1.93 KiB (5.1 KiB)
Loading image diff...
+5.99 KiB (8.76 KiB)
Loading image diff...
Loading