當前位置: 首頁>>代碼示例>>Java>>正文


Java SearchableInfo.getSuggestPath方法代碼示例

本文整理匯總了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);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:27,代碼來源:SuggestionsAdapter.java

示例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);
}
 
開發者ID:Qwaz,項目名稱:solved-hacking-problem,代碼行數:28,代碼來源:da.java

示例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;
}
 
開發者ID:Hamz-a,項目名稱:MyCTFWriteUps,代碼行數:35,代碼來源:SuggestionsAdapter.java

示例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);
}
 
開發者ID:GigigoGreenLabs,項目名稱:permissionsModule,代碼行數:48,代碼來源:SuggestionsAdapter.java

示例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);
    }
 
開發者ID:dklisiaris,項目名稱:downtown,代碼行數:46,代碼來源:CustomSuggestionsAdapter.java


注:本文中的android.app.SearchableInfo.getSuggestPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。