/// <summary>You can set a custom adapter if you wish.</summary> /// <remarks> /// You can set a custom adapter if you wish. Otherwise the default adapter is used to /// display the suggestions from the suggestions provider associated with the SearchableInfo. /// </remarks> /// <seealso cref="setSearchableInfo(android.app.SearchableInfo)">setSearchableInfo(android.app.SearchableInfo) /// </seealso> public virtual void setSuggestionsAdapter(android.widget.CursorAdapter adapter) { mSuggestionsAdapter = adapter; mQueryTextView.setAdapter(mSuggestionsAdapter); }
/// <summary>Updates the auto-complete text view.</summary> /// <remarks>Updates the auto-complete text view.</remarks> private void updateSearchAutoComplete() { mQueryTextView.setDropDownAnimationStyle(0); // no animation mQueryTextView.setThreshold(mSearchable.getSuggestThreshold()); mQueryTextView.setImeOptions(mSearchable.getImeOptions()); int inputType = mSearchable.getInputType(); // We only touch this if the input type is set up for text (which it almost certainly // should be, in the case of search!) if ((inputType & android.text.InputTypeClass.TYPE_MASK_CLASS) == android.text.InputTypeClass.TYPE_CLASS_TEXT) { // The existence of a suggestions authority is the proxy for "suggestions // are available here" inputType &= ~android.text.InputTypeClass.TYPE_TEXT_FLAG_AUTO_COMPLETE; if (mSearchable.getSuggestAuthority() != null) { inputType |= android.text.InputTypeClass.TYPE_TEXT_FLAG_AUTO_COMPLETE; } } mQueryTextView.setInputType(inputType); // 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) { mSuggestionsAdapter = new android.widget.SuggestionsAdapter(getContext(), this, mSearchable , mOutsideDrawablesCache); mQueryTextView.setAdapter(mSuggestionsAdapter); ((android.widget.SuggestionsAdapter)mSuggestionsAdapter).setQueryRefinement(mQueryRefinement ? android.widget.SuggestionsAdapter.REFINE_ALL : android.widget.SuggestionsAdapter .REFINE_BY_ENTRY); } }