From 348e69cfabec21ccfbe708df06f0a7ea541a3053 Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Wed, 16 Feb 2011 16:49:50 -0800 Subject: Fix bug 3413800 - Revise AutoCompleteTextView dropdown behavior Be more conservative with when we let an AutoCompleteTextView's dropdown box of completion suggestions cover the IME. Disable the expand-when-touched behavior of the dropdown list when more than 3 items can be seen at a time without it. Don't let a ListPopupWindow that is expanding in response to touch scroll the anchor view within its parent and slide the dropdown out from under the user's finger. Change-Id: I009accfd4e841c9a5e1072735d8a0b067a0bc06a --- core/java/android/widget/PopupWindow.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'core/java/android/widget/PopupWindow.java') diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java index 439e0cabe19f..53932af65404 100644 --- a/core/java/android/widget/PopupWindow.java +++ b/core/java/android/widget/PopupWindow.java @@ -90,6 +90,7 @@ public class PopupWindow { private int mSplitTouchEnabled = -1; private boolean mLayoutInScreen; private boolean mClipToScreen; + private boolean mAllowScrollingAnchorParent = true; private OnTouchListener mTouchInterceptor; @@ -592,6 +593,16 @@ public class PopupWindow { mClipToScreen = enabled; setClippingEnabled(!enabled); } + + /** + * Allow PopupWindow to scroll the anchor's parent to provide more room + * for the popup. Enabled by default. + * + * @param enabled True to scroll the anchor's parent when more room is desired by the popup. + */ + void setAllowScrollingAnchorParent(boolean enabled) { + mAllowScrollingAnchorParent = enabled; + } /** *

Indicates whether the popup window supports splitting touches.

@@ -1045,7 +1056,8 @@ public class PopupWindow { anchor.getWindowVisibleDisplayFrame(displayFrame); final View root = anchor.getRootView(); - if (p.y + mPopupHeight > displayFrame.bottom || p.x + mPopupWidth - root.getWidth() > 0) { + if (mAllowScrollingAnchorParent && (p.y + mPopupHeight > displayFrame.bottom || + p.x + mPopupWidth - root.getWidth() > 0)) { // if the drop down disappears at the bottom of the screen. we try to // scroll a parent scrollview or move the drop down back up on top of // the edit box -- cgit v1.2.3