diff options
| author | Dianne Hackborn <hackbod@google.com> | 2011-01-18 15:32:44 -0800 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2011-01-18 15:32:44 -0800 |
| commit | 2ec5a7160b3d32887b2428edef7a751ee3700809 (patch) | |
| tree | 7c5b8aeaee085134d028d2b1018138d33ff167d8 /core/java/android/app/Dialog.java | |
| parent | 761a6b7fdbe2bcc6db4306af9705dcb22b036068 (diff) | |
| parent | 36c84403ec07439d11ed284ac5f9a9db807fbf92 (diff) | |
am 36c84403: Merge "Fix issue #3362484: Can\'t dismiss activity picker by tapping outside dialog" into honeycomb
* commit '36c84403ec07439d11ed284ac5f9a9db807fbf92':
Fix issue #3362484: Can't dismiss activity picker by tapping outside dialog
Diffstat (limited to 'core/java/android/app/Dialog.java')
| -rw-r--r-- | core/java/android/app/Dialog.java | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java index 6791400a0055..7365670a9aaa 100644 --- a/core/java/android/app/Dialog.java +++ b/core/java/android/app/Dialog.java @@ -41,7 +41,6 @@ import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.View.OnCreateContextMenuListener; -import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.Window; @@ -90,12 +89,6 @@ public class Dialog implements DialogInterface, Window.Callback, private Message mDismissMessage; private Message mShowMessage; - /** - * Whether to cancel the dialog when a touch is received outside of the - * window's bounds. - */ - private boolean mCanceledOnTouchOutside = false; - private OnKeyListener mOnKeyListener; private boolean mCreated = false; @@ -597,8 +590,7 @@ public class Dialog implements DialogInterface, Window.Callback, * happens outside of the window bounds. */ public boolean onTouchEvent(MotionEvent event) { - if (mCancelable && mCanceledOnTouchOutside && event.getAction() == MotionEvent.ACTION_DOWN - && isOutOfBounds(event) && mDecor != null && mShowing) { + if (mCancelable && mShowing && mWindow.shouldCloseOnTouch(mContext, event)) { cancel(); return true; } @@ -606,16 +598,6 @@ public class Dialog implements DialogInterface, Window.Callback, return false; } - private boolean isOutOfBounds(MotionEvent event) { - final int x = (int) event.getX(); - final int y = (int) event.getY(); - final int slop = ViewConfiguration.get(mContext).getScaledWindowTouchSlop(); - final View decorView = getWindow().getDecorView(); - return (x < -slop) || (y < -slop) - || (x > (decorView.getWidth()+slop)) - || (y > (decorView.getHeight()+slop)); - } - /** * Called when the trackball was moved and not handled by any of the * views inside of the activity. So, for example, if the trackball moves @@ -1021,7 +1003,7 @@ public class Dialog implements DialogInterface, Window.Callback, mCancelable = true; } - mCanceledOnTouchOutside = cancel; + mWindow.setCloseOnTouchOutside(cancel); } /** |
