diff options
| author | Dianne Hackborn <hackbod@google.com> | 2011-01-18 21:56:45 -0800 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2011-01-18 21:56:45 -0800 |
| commit | 7fc5d4b8e7145413411da3320495388f09fab536 (patch) | |
| tree | f48771a1c24f02454388dd383285f80104342998 /core/java/android/app/Dialog.java | |
| parent | 7cca7e0b28679cf09ce6b56687c3a9679a6c7296 (diff) | |
| parent | 2ec5a7160b3d32887b2428edef7a751ee3700809 (diff) | |
am 2ec5a716: am 36c84403: Merge "Fix issue #3362484: Can\'t dismiss activity picker by tapping outside dialog" into honeycomb
* commit '2ec5a7160b3d32887b2428edef7a751ee3700809':
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 b0929dd0aa6c..7b794f2b0399 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 @@ -1070,7 +1052,7 @@ public class Dialog implements DialogInterface, Window.Callback, mCancelable = true; } - mCanceledOnTouchOutside = cancel; + mWindow.setCloseOnTouchOutside(cancel); } /** |
