当前位置: 首页>>代码示例>>Java>>正文


Java SearchRecentSuggestionsProvider类代码示例

本文整理汇总了Java中android.content.SearchRecentSuggestionsProvider的典型用法代码示例。如果您正苦于以下问题:Java SearchRecentSuggestionsProvider类的具体用法?Java SearchRecentSuggestionsProvider怎么用?Java SearchRecentSuggestionsProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SearchRecentSuggestionsProvider类属于android.content包,在下文中一共展示了SearchRecentSuggestionsProvider类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendSearchIntent

import android.content.SearchRecentSuggestionsProvider; //导入依赖的package包/类
private void sendSearchIntent () {
    try {
        Intent sendIntent = new Intent(this, Class.forName(searchableActivity));
        sendIntent.setAction(Intent.ACTION_SEARCH);
        sendIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        sendIntent.putExtra(SearchManager.QUERY, query);

        // If it is set one-line mode, directly saves the suggestion in the provider
        if (!CustomSearchableInfo.getIsTwoLineExhibition()) {
            SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, providerAuthority, SearchRecentSuggestionsProvider.DATABASE_MODE_QUERIES);
            suggestions.saveRecentQuery(query, null);
        }

        startActivity(sendIntent);
        finish();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}
 
开发者ID:edsilfer,项目名称:custom-searchable,代码行数:20,代码来源:SearchActivity.java

示例2: getManifestConfig

import android.content.SearchRecentSuggestionsProvider; //导入依赖的package包/类
private void getManifestConfig () {
    try {
        Map<String, String> providers = ManifestParser.getProviderNameAndAuthority(this);

        OUTER: for (String key : providers.keySet()) {
            providerAuthority = providers.get(key).toString();
            providerName = key;

            if (Class.forName(providerName).getSuperclass().equals(SearchRecentSuggestionsProvider.class)) {
                isRecentSuggestionsProvider = Boolean.TRUE;

                break OUTER;
            } else {
                isRecentSuggestionsProvider = Boolean.FALSE;
            }
        }

        searchableActivity = ManifestParser.getSearchableActivity(this);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}
 
开发者ID:edsilfer,项目名称:custom-searchable,代码行数:23,代码来源:SearchActivity.java

示例3: requestSearch

import android.content.SearchRecentSuggestionsProvider; //导入依赖的package包/类
/**
 * Tests if search query is valid and internet connection is available.
 * Then starts a new search.
 *
 * @param query Query to search for
 */
protected void requestSearch(String query) {
    mQuery = query;
    if (query.length() < mMinLength) {
        final String text = String.format(getString(R.string.min_search_len), mMinLength);
        Utils.showToast(this, text);
        return;
    }

    /*if (!Utils.isConnected(this)) {
        showNoInternetLayout();
        return;
    }*/

    // Add query to recents
    SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, mAuthority, SearchRecentSuggestionsProvider.DATABASE_MODE_QUERIES);
    suggestions.saveRecentQuery(query, null);

    // Tell activity to start searching
    onStartSearch(query);
}
 
开发者ID:TCA-Team,项目名称:TumCampusApp,代码行数:27,代码来源:ActivityForSearching.java


注:本文中的android.content.SearchRecentSuggestionsProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。