summaryrefslogtreecommitdiff
path: root/core/java/android/widget/SearchView.java
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2011-11-03 11:32:44 -0700
committerAmith Yamasani <yamasani@google.com>2011-11-03 11:32:44 -0700
commit8790764e4c20737e57dafdfb3bb1c8cdb84169c5 (patch)
treee2cb0c70d512f94683be0384a10cf67d3c7bfbda /core/java/android/widget/SearchView.java
parent00ef15b98ac0579ebd5f81a1753bc18384e88b8b (diff)
Close suggestions cursor when SearchView is detached.
Make sure that delayed filter requests don't go through after the view was detached. Bug: 5484819 Change-Id: I4d5ff5ea9b52109ecce7f84fa4d91dfcb6225037
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 6df80e4094c0..f1cb173cf7ad 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;
}
@@ -1190,6 +1200,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);
}