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


Java SearchRecentSuggestions.saveRecentQuery方法代码示例

本文整理汇总了Java中android.provider.SearchRecentSuggestions.saveRecentQuery方法的典型用法代码示例。如果您正苦于以下问题:Java SearchRecentSuggestions.saveRecentQuery方法的具体用法?Java SearchRecentSuggestions.saveRecentQuery怎么用?Java SearchRecentSuggestions.saveRecentQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.provider.SearchRecentSuggestions的用法示例。


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

示例1: handleIntent

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
private void handleIntent(Intent intent) {
  if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
    String query = intent.getStringExtra(SearchManager.QUERY);
    //set the text on the search view without submission
    searchView.setQuery(query, false);
    searchView.clearFocus();
    //save search result
    SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
        ArtistsSearchRecentSuggestionsProvider.AUTHORITY,
        ArtistsSearchRecentSuggestionsProvider.MODE);
    suggestions.saveRecentQuery(query, null);
    viewModel.query(query);
    //use the query to search your data somehow
    Toast.makeText(this, query, Toast.LENGTH_SHORT).show();
  }
}
 
开发者ID:charlesng,项目名称:SampleAppArch,代码行数:17,代码来源:ShoppingActivity.java

示例2: onCreate

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	String query = getIntent().getStringExtra(SearchManager.QUERY);

	if (query != null)
	{
		SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, SearchSuggestionProvider.AUTHORITY, SearchSuggestionProvider.MODE);
		suggestions.saveRecentQuery(query, null);

		Intent intent = new Intent(QueryReceiverActivity.this, SearchActivity.class);
		intent.putExtra(Constants.INTENT_EXTRA_NAME_QUERY, query);
		startActivityForResultWithoutTransition(QueryReceiverActivity.this, intent);
	}
	finish();
	Util.disablePendingTransition(this);
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:20,代码来源:QueryReceiverActivity.java

示例3: onCreate

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	String query = getIntent().getStringExtra(SearchManager.QUERY);

	if (query != null)
	{
		SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, SearchSuggestionProvider.AUTHORITY, SearchSuggestionProvider.MODE);
		suggestions.saveRecentQuery(query, null);

		Intent intent = new Intent(VoiceQueryReceiverActivity.this, SearchActivity.class);
		intent.putExtra(Constants.INTENT_EXTRA_NAME_QUERY, query);
		intent.putExtra(Constants.INTENT_EXTRA_NAME_AUTOPLAY, true);
		startActivityForResultWithoutTransition(VoiceQueryReceiverActivity.this, intent);
	}
	finish();
	Util.disablePendingTransition(this);
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:21,代码来源:VoiceQueryReceiverActivity.java

示例4: onCreate

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    if (getIntent().hasExtra(SearchManager.QUERY)) {
        mQuery = getIntent().getStringExtra(SearchManager.QUERY);
    }
    super.onCreate(savedInstanceState);
    if (!TextUtils.isEmpty(mQuery)) {
        getSupportActionBar().setSubtitle(mQuery);
        SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
                SearchRecentSuggestionsProvider.PROVIDER_AUTHORITY,
                SearchRecentSuggestionsProvider.MODE) {
            @Override
            public void saveRecentQuery(String queryString, String line2) {
                truncateHistory(getContentResolver(), MAX_RECENT_SUGGESTIONS - 1);
                super.saveRecentQuery(queryString, line2);
            }
        };
        suggestions.saveRecentQuery(mQuery, null);
    }
}
 
开发者ID:hidroh,项目名称:materialistic,代码行数:21,代码来源:SearchActivity.java

示例5: onNewIntent

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
@Override
public void onNewIntent(Intent intent) {
    if (DEBUG) Log.d(TAG, "New Intent: " + intent);
    String action = intent.getAction();
    String query = intent.getStringExtra(SearchManager.QUERY);

    if (intent == null) {
        if (DEBUG) Log.d(TAG, "No intent to search, querying default.");
        executeSearchTask(query);

    } else if (Intent.ACTION_SEARCH.equals(action) && query != null) {
        if (DEBUG) Log.d(TAG, "onNewIntent received search intent and saving.");
        SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
                VenueQuerySuggestionsProvider.AUTHORITY, VenueQuerySuggestionsProvider.MODE);
        suggestions.saveRecentQuery(query, null);
        executeSearchTask(query);
    } else {
        onSearchRequested();
    }
}
 
开发者ID:vsvankhede,项目名称:foursquared.eclair,代码行数:21,代码来源:SearchVenuesActivity.java

示例6: search

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
private void search(final String q) {
    if (!TextUtils.isEmpty(q)) {
        this.q = q;
        SearchRecentSuggestions suggestions = new SearchRecentSuggestions(getActivity(),
                SearchSuggestionProvider.AUTHORITY, SearchSuggestionProvider.MODE);
        suggestions.saveRecentQuery(this.q, null);
        switch (viewPager.getCurrentItem()) {
            case 0:
                ((SearchStatusFragment) getSearchWeiboFragment()).search();
                break;
            case 1:
                ((SearchUserFragment) getSearchUserFragment()).search();
                break;
        }
    }
}
 
开发者ID:lookwhatlook,项目名称:WeiboWeiBaTong,代码行数:17,代码来源:SearchMainParentFragment.java

示例7: onQueryTextSubmit

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
@Override
public boolean onQueryTextSubmit(String query) {
    //Avoid bug: this is called twice in some devices (ACTION_UP and ACTION_DOWN)
    long actualSearchTime = Calendar.getInstance().getTimeInMillis();
    if (actualSearchTime < lastSearchTime + 1000)
        return true;

    lastSearchTime = actualSearchTime;
    if (TextUtils.isEmpty(query)) {
        mAdapter.clearAll();
    } else {
        lastQuery = query;
        SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
                RecentSearchProvider.AUTHORITY, RecentSearchProvider.MODE);
        suggestions.saveRecentQuery(query, null);
        mAdapter.getFilter().filter(query);
    }
    return true;
}
 
开发者ID:AlbertGrobas,项目名称:Leaderboards,代码行数:20,代码来源:MainActivity.java

示例8: sendSearchIntent

import android.provider.SearchRecentSuggestions; //导入方法依赖的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

示例9: doSearchQuery

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
private void doSearchQuery(final Intent queryIntent, final String entryPoint) {
    
    // The search query is provided as an "extra" string in the query intent
    final String queryString = queryIntent.getStringExtra(SearchManager.QUERY);
    
    // Record the query string in the recent queries suggestions provider.
    SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, 
            SearchSuggestionProvider.AUTHORITY, SearchSuggestionProvider.MODE);
    suggestions.saveRecentQuery(queryString, null);
    
    
    // Do the actual search, write to searchResults field
     showDialog(SEARCH_DIALOG);
     
     MapQuestGeocoder geocoder = new MapQuestGeocoder();
     geocoder.geocode(queryString, null, this, MAPQUEST_KEY);
}
 
开发者ID:takyonxxx,项目名称:Flight-Computer-Android-Flightradar24,代码行数:18,代码来源:SearchQueryResults.java

示例10: onNewIntent

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
	super.onNewIntent(intent);
	setIntent(intent);
	if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
		String query = intent.getStringExtra(SearchManager.QUERY);
		if (!TextUtils.isEmpty(query)) {
			SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
					SearchRecipeSuggestionsProvider.AUTHORITY,
					SearchRecipeSuggestionsProvider.MODE);
			suggestions.saveRecentQuery(query, null);

		}
		recipeListFragment.setQuery(query);
	}

}
 
开发者ID:groupsky,项目名称:android-recipes-app,代码行数:18,代码来源:RecipeItemListActivity.java

示例11: handleIntent

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
private void handleIntent(Intent intent) {
	if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
		viewPager.setCurrentItem(TabPagerAdapter.ANIME_TAB, true);
		String query = intent.getStringExtra(SearchManager.QUERY);
		if (menuItemSearchView != null) {
			MenuItemCompat.collapseActionView(menuItemSearchView);
		}
		SearchRecentSuggestions suggestions = new SearchRecentSuggestions(
				this, SearchFriendsProvider.AUTHORITY,
				SearchFriendsProvider.MODE);
		suggestions.saveRecentQuery(query, null);
		// call method that handles the search request
		if (RequestHelper.isNetworkAvailable(FeedTabActivity.this)) {
			//startFeedRequests(query);
			notifyFragments(query);
		} else {
			Toast.makeText(this, R.string.no_network_connection_available,
					Toast.LENGTH_LONG).show();
		}

	}
}
 
开发者ID:DandreX,项目名称:MALFriends,代码行数:23,代码来源:FeedTabActivity.java

示例12: search

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
private void search(String searchQuery, Time goToTime) {
    // save query in recent queries
    SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
            Utils.getSearchAuthority(this),
            CalendarRecentSuggestionsProvider.MODE);
    suggestions.saveRecentQuery(searchQuery, null);


    EventInfo searchEventInfo = new EventInfo();
    searchEventInfo.eventType = EventType.SEARCH;
    searchEventInfo.query = searchQuery;
    searchEventInfo.viewType = ViewType.AGENDA;
    if (goToTime != null) {
        searchEventInfo.startTime = goToTime;
    }
    mController.sendEvent(this, searchEventInfo);
    mQuery = searchQuery;
    if (mSearchView != null) {
        mSearchView.setQuery(mQuery, false);
        mSearchView.clearFocus();
    }
}
 
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:23,代码来源:SearchActivity.java

示例13: requestSearch

import android.provider.SearchRecentSuggestions; //导入方法依赖的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

示例14: run

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
@Override
public void run() {
	//Se a pesquisa não retornou nada, não salva a sugestão.
	//Esta verificação não conflitará com outras pesquisas pois está sendo executado na Thread de UI.
	if (entityListAdapter.getItemCount() == 0) {
		return;
	}
	
	SearchRecentSuggestions suggestions = new SearchRecentSuggestions(getActivity(),
                                                                            EntitySearchSuggestionsProvider.AUTHORITY,
                                                                            EntitySearchSuggestionsProvider.MODE);
	suggestions.saveRecentQuery(query, searchEntity);
}
 
开发者ID:ZalemSoftware,项目名称:Ymir,代码行数:14,代码来源:EntityListFragment.java

示例15: newIntent

import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
public void newIntent(Intent intent)
{
	setIntent(intent);

	// search action
	if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
		String query = intent.getStringExtra(SearchManager.QUERY);

		SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, SearchSuggestions.AUTHORITY, SearchSuggestions.MODE);
		suggestions.saveRecentQuery(query, null);
		fromSearch = true;
		queryString = query;
			
	}	
}
 
开发者ID:aToxyD,项目名称:android_boot_image_manager_apk,代码行数:16,代码来源:TextEditor.java


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