From defb1df520ce2e642dc42e8fc1082562294cf741 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Thu, 4 Mar 2010 14:29:54 -0800 Subject: [PATCH] Show AutoCompleteTextView dropdown in Search dialog when cursor updates. Fixes b/2426929 Calls onFilterComplete when the data set changes, so that it can recompute whether the dropdown should be shown or not. --- core/java/android/app/SearchDialog.java | 9 ++++++++- core/java/android/app/SuggestionsAdapter.java | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index c2afd070a209e..c951ce9a0351d 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -576,7 +576,14 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS } mVoiceButton.setVisibility(visibility); } - + + /** Called by SuggestionsAdapter when the cursor contents changed. */ + void onDataSetChanged() { + if (mSearchAutoComplete != null && mSuggestionsAdapter != null) { + mSearchAutoComplete.onFilterComplete(mSuggestionsAdapter.getCount()); + } + } + /** * Hack to determine whether this is the browser, so we can adjust the UI. */ diff --git a/core/java/android/app/SuggestionsAdapter.java b/core/java/android/app/SuggestionsAdapter.java index 3e11a3f55b07f..1ae93150d0490 100644 --- a/core/java/android/app/SuggestionsAdapter.java +++ b/core/java/android/app/SuggestionsAdapter.java @@ -189,6 +189,8 @@ class SuggestionsAdapter extends ResourceCursorAdapter { if (DBG) Log.d(LOG_TAG, "notifyDataSetChanged"); super.notifyDataSetChanged(); + mSearchDialog.onDataSetChanged(); + updateSpinnerState(getCursor()); }