diff options
| author | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-22 16:13:40 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-22 16:13:40 -0700 |
| commit | 4182e684968fd7b30de800fd63186623e22ef409 (patch) | |
| tree | 70ac488994a8fbd47d2e14561f27cdaa136e0adc /core/java/android/widget/AutoCompleteTextView.java | |
| parent | eba337ad09ba93b31f4e9ec8f99be3ae2811bf89 (diff) | |
| parent | d4760d77e7e8ab66af0307dcae39e0a8e9d90a14 (diff) | |
Merge change 8255 into donut
* changes:
Add new hidden API setForceIgnoreOutsideTouch to AutoCompleteTextView for use by SearchDialog. SearchDialog wants to be able to say a dropdown should not always be visible but still let it ignore outside touch when it does show.
Diffstat (limited to 'core/java/android/widget/AutoCompleteTextView.java')
| -rw-r--r-- | core/java/android/widget/AutoCompleteTextView.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java index 47798a4266cc..6848a5555d57 100644 --- a/core/java/android/widget/AutoCompleteTextView.java +++ b/core/java/android/widget/AutoCompleteTextView.java @@ -116,6 +116,8 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe private boolean mDropDownAlwaysVisible = false; private boolean mDropDownDismissedOnCompletion = true; + + private boolean mForceIgnoreOutsideTouch = false; private int mLastKeyCode = KeyEvent.KEYCODE_UNKNOWN; private boolean mOpenBefore; @@ -1142,6 +1144,8 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe heightSpec = mDropDownHeight; } + mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible); + mPopup.update(getDropDownAnchorView(), mDropDownHorizontalOffset, mDropDownVerticalOffset, widthSpec, heightSpec); } else { @@ -1170,7 +1174,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe // use outside touchable to dismiss drop down when touching outside of it, so // only set this if the dropdown is not always visible - mPopup.setOutsideTouchable(!mDropDownAlwaysVisible); + mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible); mPopup.setTouchInterceptor(new PopupTouchIntercepter()); mPopup.showAsDropDown(getDropDownAnchorView(), mDropDownHorizontalOffset, mDropDownVerticalOffset); @@ -1179,6 +1183,17 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe post(mHideSelector); } } + + /** + * Forces outside touches to be ignored. Normally if {@link #isDropDownAlwaysVisible()} is + * false, we allow outside touch to dismiss the dropdown. If this is set to true, then we + * ignore outside touch even when the drop down is not set to always visible. + * + * @hide used only by SearchDialog + */ + public void setForceIgnoreOutsideTouch(boolean forceIgnoreOutsideTouch) { + mForceIgnoreOutsideTouch = forceIgnoreOutsideTouch; + } /** * <p>Builds the popup window's content and returns the height the popup |
