Loading core/java/android/widget/AutoCompleteTextView.java +4 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,8 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe static final boolean DEBUG = false; static final String TAG = "AutoCompleteTextView"; static final int EXPAND_MAX = 3; private CharSequence mHintText; private TextView mHintView; private int mHintResource; Loading Loading @@ -1057,8 +1059,10 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe if (!isPopupShowing()) { // Make sure the list does not obscure the IME when shown for the first time. mPopup.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NEEDED); mPopup.setListItemExpandMax(EXPAND_MAX); } mPopup.show(); mPopup.getListView().setOverScrollMode(View.OVER_SCROLL_ALWAYS); } /** Loading core/java/android/widget/ListPopupWindow.java +17 −2 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ public class ListPopupWindow { private boolean mDropDownAlwaysVisible = false; private boolean mForceIgnoreOutsideTouch = false; int mListItemExpandMaximum = Integer.MAX_VALUE; private View mPromptView; private int mPromptPosition = POSITION_PROMPT_ABOVE; Loading Loading @@ -519,6 +520,7 @@ public class ListPopupWindow { int heightSpec = 0; boolean noInputMethod = isInputMethodNotNeeded(); mPopup.setAllowScrollingAnchorParent(!noInputMethod); if (mPopup.isShowing()) { if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) { Loading Loading @@ -774,6 +776,16 @@ public class ListPopupWindow { return mDropDownList; } /** * The maximum number of list items that can be visible and still have * the list expand when touched. * * @param max Max number of items that can be visible and still allow the list to expand. */ void setListItemExpandMax(int max) { mListItemExpandMaximum = max; } /** * Filter key down events. By forwarding key down events to this function, * views using non-modal ListPopupWindow can have it handle key selection of items. Loading Loading @@ -1210,10 +1222,13 @@ public class ListPopupWindow { private class ResizePopupRunnable implements Runnable { public void run() { if (mDropDownList != null && mDropDownList.getCount() > mDropDownList.getChildCount() && mDropDownList.getChildCount() <= mListItemExpandMaximum) { mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); show(); } } } private class PopupTouchInterceptor implements OnTouchListener { public boolean onTouch(View v, MotionEvent event) { Loading core/java/android/widget/PopupWindow.java +13 −1 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ public class PopupWindow { private int mSplitTouchEnabled = -1; private boolean mLayoutInScreen; private boolean mClipToScreen; private boolean mAllowScrollingAnchorParent = true; private OnTouchListener mTouchInterceptor; Loading Loading @@ -593,6 +594,16 @@ public class PopupWindow { 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; } /** * <p>Indicates whether the popup window supports splitting touches.</p> * Loading Loading @@ -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 Loading Loading
core/java/android/widget/AutoCompleteTextView.java +4 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,8 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe static final boolean DEBUG = false; static final String TAG = "AutoCompleteTextView"; static final int EXPAND_MAX = 3; private CharSequence mHintText; private TextView mHintView; private int mHintResource; Loading Loading @@ -1057,8 +1059,10 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe if (!isPopupShowing()) { // Make sure the list does not obscure the IME when shown for the first time. mPopup.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NEEDED); mPopup.setListItemExpandMax(EXPAND_MAX); } mPopup.show(); mPopup.getListView().setOverScrollMode(View.OVER_SCROLL_ALWAYS); } /** Loading
core/java/android/widget/ListPopupWindow.java +17 −2 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ public class ListPopupWindow { private boolean mDropDownAlwaysVisible = false; private boolean mForceIgnoreOutsideTouch = false; int mListItemExpandMaximum = Integer.MAX_VALUE; private View mPromptView; private int mPromptPosition = POSITION_PROMPT_ABOVE; Loading Loading @@ -519,6 +520,7 @@ public class ListPopupWindow { int heightSpec = 0; boolean noInputMethod = isInputMethodNotNeeded(); mPopup.setAllowScrollingAnchorParent(!noInputMethod); if (mPopup.isShowing()) { if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) { Loading Loading @@ -774,6 +776,16 @@ public class ListPopupWindow { return mDropDownList; } /** * The maximum number of list items that can be visible and still have * the list expand when touched. * * @param max Max number of items that can be visible and still allow the list to expand. */ void setListItemExpandMax(int max) { mListItemExpandMaximum = max; } /** * Filter key down events. By forwarding key down events to this function, * views using non-modal ListPopupWindow can have it handle key selection of items. Loading Loading @@ -1210,10 +1222,13 @@ public class ListPopupWindow { private class ResizePopupRunnable implements Runnable { public void run() { if (mDropDownList != null && mDropDownList.getCount() > mDropDownList.getChildCount() && mDropDownList.getChildCount() <= mListItemExpandMaximum) { mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); show(); } } } private class PopupTouchInterceptor implements OnTouchListener { public boolean onTouch(View v, MotionEvent event) { Loading
core/java/android/widget/PopupWindow.java +13 −1 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ public class PopupWindow { private int mSplitTouchEnabled = -1; private boolean mLayoutInScreen; private boolean mClipToScreen; private boolean mAllowScrollingAnchorParent = true; private OnTouchListener mTouchInterceptor; Loading Loading @@ -593,6 +594,16 @@ public class PopupWindow { 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; } /** * <p>Indicates whether the popup window supports splitting touches.</p> * Loading Loading @@ -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 Loading