本文整理匯總了Java中android.app.SearchableInfo.getSuggestPath方法的典型用法代碼示例。如果您正苦於以下問題:Java SearchableInfo.getSuggestPath方法的具體用法?Java SearchableInfo.getSuggestPath怎麽用?Java SearchableInfo.getSuggestPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.app.SearchableInfo
的用法示例。
在下文中一共展示了SearchableInfo.getSuggestPath方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSearchManagerSuggestions
import android.app.SearchableInfo; //導入方法依賴的package包/類
Cursor getSearchManagerSuggestions(SearchableInfo searchable, String query, int limit) {
if (searchable == null) {
return null;
}
String authority = searchable.getSuggestAuthority();
if (authority == null) {
return null;
}
Builder uriBuilder = new Builder().scheme(Utils.RESPONSE_CONTENT).authority(authority).query("").fragment("");
String contentPath = searchable.getSuggestPath();
if (contentPath != null) {
uriBuilder.appendEncodedPath(contentPath);
}
uriBuilder.appendPath("search_suggest_query");
String selection = searchable.getSuggestSelection();
String[] selArgs = null;
if (selection != null) {
selArgs = new String[]{query};
} else {
uriBuilder.appendPath(query);
}
if (limit > 0) {
uriBuilder.appendQueryParameter("limit", String.valueOf(limit));
}
return this.mContext.getContentResolver().query(uriBuilder.build(), null, selection, selArgs, null);
}
示例2: m2692a
import android.app.SearchableInfo; //導入方法依賴的package包/類
Cursor m2692a(SearchableInfo searchableInfo, String str, int i) {
if (searchableInfo == null) {
return null;
}
String suggestAuthority = searchableInfo.getSuggestAuthority();
if (suggestAuthority == null) {
return null;
}
String[] strArr;
Builder fragment = new Builder().scheme("content").authority(suggestAuthority).query("").fragment("");
String suggestPath = searchableInfo.getSuggestPath();
if (suggestPath != null) {
fragment.appendEncodedPath(suggestPath);
}
fragment.appendPath("search_suggest_query");
String suggestSelection = searchableInfo.getSuggestSelection();
if (suggestSelection != null) {
strArr = new String[]{str};
} else {
fragment.appendPath(str);
strArr = null;
}
if (i > 0) {
fragment.appendQueryParameter("limit", String.valueOf(i));
}
return this.d.getContentResolver().query(fragment.build(), null, suggestSelection, strArr, null);
}
示例3: getSearchManagerSuggestions
import android.app.SearchableInfo; //導入方法依賴的package包/類
Cursor getSearchManagerSuggestions(SearchableInfo searchableinfo, String s, int i)
{
Object obj;
if (searchableinfo != null)
{
if ((obj = searchableinfo.getSuggestAuthority()) != null)
{
obj = (new android.net.Uri.Builder()).scheme("content").authority(((String) (obj))).query("").fragment("");
String s1 = searchableinfo.getSuggestPath();
if (s1 != null)
{
((android.net.Uri.Builder) (obj)).appendEncodedPath(s1);
}
((android.net.Uri.Builder) (obj)).appendPath("search_suggest_query");
s1 = searchableinfo.getSuggestSelection();
searchableinfo = null;
if (s1 != null)
{
searchableinfo = new String[1];
searchableinfo[0] = s;
} else
{
((android.net.Uri.Builder) (obj)).appendPath(s);
}
if (i > 0)
{
((android.net.Uri.Builder) (obj)).appendQueryParameter("limit", String.valueOf(i));
}
s = ((android.net.Uri.Builder) (obj)).build();
return mContext.getContentResolver().query(s, null, s1, searchableinfo, null);
}
}
return null;
}
示例4: getSearchManagerSuggestions
import android.app.SearchableInfo; //導入方法依賴的package包/類
/**
* Import of hidden method: SearchManager.getSuggestions(SearchableInfo, String, int).
*/
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);
}
示例5: getSuggestions
import android.app.SearchableInfo; //導入方法依賴的package包/類
public Cursor getSuggestions(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("")
.fragment("");
// 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);
}