summaryrefslogtreecommitdiff
path: root/core/java/android/widget/SearchView.java
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2011-11-04 10:41:10 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-11-04 10:41:10 -0700
commitd69c203cd48c1d0d3be92fb0396656ee8adc1185 (patch)
treeec6d2e8b832604a5316937c447e83deb97e6396a /core/java/android/widget/SearchView.java
parent8f7d88cc67e1c89c960b932ceafc60d378aa2ad6 (diff)
parent8790764e4c20737e57dafdfb3bb1c8cdb84169c5 (diff)
Merge "Close suggestions cursor when SearchView is detached." into ics-mr1
Diffstat (limited to 'core/java/android/widget/SearchView.java')
-rw-r--r--core/java/android/widget/SearchView.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index 399d217216a7..e84ae9720b1e 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -151,6 +151,14 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
}
};
+ private Runnable mReleaseCursorRunnable = new Runnable() {
+ public void run() {
+ if (mSuggestionsAdapter != null && mSuggestionsAdapter instanceof SuggestionsAdapter) {
+ mSuggestionsAdapter.changeCursor(null);
+ }
+ }
+ };
+
// For voice searching
private final Intent mVoiceWebSearchIntent;
private final Intent mVoiceAppSearchIntent;
@@ -759,6 +767,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
@Override
protected void onDetachedFromWindow() {
removeCallbacks(mUpdateDrawableStateRunnable);
+ post(mReleaseCursorRunnable);
super.onDetachedFromWindow();
}
@@ -1028,7 +1037,9 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
}
}
mQueryTextView.setInputType(inputType);
-
+ if (mSuggestionsAdapter != null) {
+ mSuggestionsAdapter.changeCursor(null);
+ }
// 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) {
@@ -1177,7 +1188,6 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
public void onActionViewCollapsed() {
clearFocus();
updateViewsVisibility(true);
- mQueryTextView.setText("");
mQueryTextView.setImeOptions(mCollapsedImeOptions);
mExpandedInActionView = false;
}
@@ -1192,6 +1202,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
mExpandedInActionView = true;
mCollapsedImeOptions = mQueryTextView.getImeOptions();
mQueryTextView.setImeOptions(mCollapsedImeOptions | EditorInfo.IME_FLAG_NO_FULLSCREEN);
+ mQueryTextView.setText("");
setIconified(false);
}