List of usage examples for android.app SearchableInfo getSuggestSelection
public String getSuggestSelection()
From source file:com.aboveware.sms.contacts.ContactSuggestionsAdapter.java
/** * Import of hidden method: SearchManager.getSuggestions(SearchableInfo, String, int). */// w w w . ja va 2 s . co m Cursor getSearchManagerSuggestions(SearchableInfo searchable, String query, int limit) { if (searchable == null) { return null; } String authority = searchable.getSuggestAuthority(); if (authority == null) { return null; } Uri.Builder uriBuilder = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(authority) .query("") // TODO: // Remove, // workaround // for a bug // in // Uri.writeToParcel() .fragment(""); // TODO: Remove, workaround for a bug in Uri.writeToParcel() // if content path provided, insert it now final String contentPath = searchable.getSuggestPath(); if (contentPath != null) { uriBuilder.appendEncodedPath(contentPath); } // append standard suggestion query path uriBuilder.appendPath(SearchManager.SUGGEST_URI_PATH_QUERY); // get the query selection, may be null String selection = searchable.getSuggestSelection(); // inject query, either as selection args or inline String[] selArgs = null; if (selection != null) { // use selection if provided selArgs = new String[] { query }; } else { // no selection, use REST pattern uriBuilder.appendPath(query); } if (limit > 0) { uriBuilder.appendQueryParameter("limit", String.valueOf(limit)); } Uri uri = uriBuilder.build(); // finally, make the query return mContext.getContentResolver().query(uri, null, selection, selArgs, null); }
From source file:android.support.v7.widget.SuggestionsAdapter.java
/** * Import of hidden method: SearchManager.getSuggestions(SearchableInfo, String, int). *//*from w w w . j a v a2 s. com*/ Cursor getSearchManagerSuggestions(SearchableInfo searchable, String query, int limit) { if (searchable == null) { return null; } String authority = searchable.getSuggestAuthority(); if (authority == null) { return null; } Uri.Builder uriBuilder = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(authority) .query("") // TODO: Remove, workaround for a bug in Uri.writeToParcel() .fragment(""); // TODO: Remove, workaround for a bug in Uri.writeToParcel() // if content path provided, insert it now final String contentPath = searchable.getSuggestPath(); if (contentPath != null) { uriBuilder.appendEncodedPath(contentPath); } // append standard suggestion query path uriBuilder.appendPath(SearchManager.SUGGEST_URI_PATH_QUERY); // get the query selection, may be null String selection = searchable.getSuggestSelection(); // inject query, either as selection args or inline String[] selArgs = null; if (selection != null) { // use selection if provided selArgs = new String[] { query }; } else { // no selection, use REST pattern uriBuilder.appendPath(query); } if (limit > 0) { uriBuilder.appendQueryParameter("limit", String.valueOf(limit)); } Uri uri = uriBuilder.build(); // finally, make the query return mContext.getContentResolver().query(uri, null, selection, selArgs, null); }