diff options
author | Mike LeBeau <mlebeau@android.com> | 2009-07-22 17:31:09 -0700 |
---|---|---|
committer | Mike LeBeau <mlebeau@android.com> | 2009-07-22 17:31:09 -0700 |
commit | e39900ca7aa73a7a484cc0cff79188940df64cdb (patch) | |
tree | 8aca52ade6a8839835d1f2b3abaaf8e27660a60b /core/java | |
parent | f57117b7331e8ec9ff43651ab6cd6b662e5391c1 (diff) | |
parent | 4182e684968fd7b30de800fd63186623e22ef409 (diff) | |
download | frameworks_base-e39900ca7aa73a7a484cc0cff79188940df64cdb.zip frameworks_base-e39900ca7aa73a7a484cc0cff79188940df64cdb.tar.gz frameworks_base-e39900ca7aa73a7a484cc0cff79188940df64cdb.tar.bz2 |
Merge commit '4182e684' into manualmerge
Conflicts:
core/java/android/widget/AutoCompleteTextView.java
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/SearchDialog.java | 2 | ||||
-rw-r--r-- | core/java/android/widget/AutoCompleteTextView.java | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index 0380c90..26b5b7a 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -541,6 +541,8 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS mSearchAutoComplete.setDropDownAlwaysVisible(false); } + mSearchAutoComplete.setForceIgnoreOutsideTouch(true); + // attach the suggestions adapter, if suggestions are available // The existence of a suggestions authority is the proxy for "suggestions available here" if (mSearchable.getSuggestAuthority() != null) { diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java index b00a475..e613ec4 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; @@ -1128,6 +1130,8 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe heightSpec = mDropDownHeight; } + mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible); + mPopup.update(getDropDownAnchorView(), mDropDownHorizontalOffset, mDropDownVerticalOffset, widthSpec, heightSpec); } else { @@ -1153,7 +1157,10 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe mPopup.setWindowLayoutMode(widthSpec, heightSpec); mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED); - mPopup.setOutsideTouchable(true); + + // 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(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible); mPopup.setTouchInterceptor(new PopupTouchIntercepter()); mPopup.showAsDropDown(getDropDownAnchorView(), mDropDownHorizontalOffset, mDropDownVerticalOffset); @@ -1162,6 +1169,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 |