List of usage examples for android.app SearchManager QUERY
String QUERY
To view the source code for android.app SearchManager QUERY.
Click Source Link
From source file:com.murati.oszk.audiobook.ui.MusicPlayerActivity.java
@Override public void setToolbarTitle(CharSequence title) { LogHelper.d(TAG, "Setting toolbar title for mediaItem", title); String mediaItem = title.toString(); // Empty or Root items if (mediaItem == null || MediaIDHelper.MEDIA_ID_ROOT.equals(mediaItem)) { title = getString(R.string.app_name); }// ww w . j a v a 2 s. c om // Search results else if (mediaItem.startsWith(MediaIDHelper.MEDIA_ID_BY_SEARCH)) { title = String.format("%s '%s'", getString(R.string.search_title), mSearchParams.getString(SearchManager.QUERY)); } // List by top level categories else if (MediaIDHelper.MEDIA_ID_BY_QUEUE.equals(mediaItem)) title = getString(R.string.browse_queue); else if (MediaIDHelper.MEDIA_ID_BY_WRITER.equals(mediaItem)) title = getString(R.string.browse_writer); else if (MediaIDHelper.MEDIA_ID_BY_GENRE.equals(mediaItem)) title = getString(R.string.browse_genres); else if (MediaIDHelper.MEDIA_ID_BY_EBOOK.equals(mediaItem)) title = getString(R.string.browse_ebook); else if (MediaIDHelper.MEDIA_ID_BY_FAVORITES.equals(mediaItem)) title = getString(R.string.browse_favorites); else if (MediaIDHelper.MEDIA_ID_BY_DOWNLOADS.equals(mediaItem)) title = getString(R.string.browse_downloads); else if (mediaItem.startsWith(MediaIDHelper.MEDIA_ID_BY_WRITER) || mediaItem.startsWith(MediaIDHelper.MEDIA_ID_BY_GENRE) || mediaItem.startsWith(MediaIDHelper.MEDIA_ID_BY_EBOOK) || mediaItem.startsWith(MediaIDHelper.MEDIA_ID_BY_FAVORITES) || mediaItem.startsWith(MediaIDHelper.MEDIA_ID_BY_DOWNLOADS)) title = MediaIDHelper.getCategoryValueFromMediaID(mediaItem); //Anything else else { LogHelper.d(TAG, "Unregistered mediaItem, passing title over", title); } setTitle(title); }
From source file:com.numenta.taurus.instance.InstanceListActivity.java
/** * If the activity was started with an intent, such as {@link Intent#ACTION_SEARCH}, * perform the action expressed in the intent. * * @param intent The intent to process//from w w w . j a va2 s . c om * @see Intent#ACTION_SEARCH */ private void handleIntent(@NonNull Intent intent) { // Handle "Search" intents if (Intent.ACTION_SEARCH.equals(intent.getAction())) { // SearchManager.QUERY is the key that a SearchManager will use to send a query string // to an Activity. String query = intent.getStringExtra(SearchManager.QUERY); _listFragment.applyFilter(query); } if (TaurusApplication.ACTION_SHOW_NOTIFICATION_LIST.equals(intent.getAction())) { clearNotifications(); if (_favorites.getCheckedRadioButtonId() == R.id.filter_none) { RadioButton b = (RadioButton) _favorites.findViewById(R.id.filter_favorites); b.setChecked(true); } } }
From source file:com.klinker.android.twitter.activities.search.SearchPager.java
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { searchQuery = intent.getStringExtra(SearchManager.QUERY); SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, MySuggestionsProvider.AUTHORITY, MySuggestionsProvider.MODE); if (searchQuery.contains("#")) { suggestions.saveRecentQuery(searchQuery.replaceAll("\"", ""), null); } else {//from ww w. j a va 2 s . c o m suggestions.saveRecentQuery(searchQuery, null); } searchQuery += " -RT"; } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri uri = intent.getData(); String uriString = uri.toString(); if (uriString.contains("status/")) { long id; String replace = uriString.substring(uriString.indexOf("status")).replace("status/", "") .replaceAll("photo/*", ""); if (replace.contains("/")) { replace = replace.substring(0, replace.indexOf("/")); } else if (replace.contains("?")) { replace = replace.substring(0, replace.indexOf("?")); } try { id = Long.parseLong(replace); } catch (Exception e) { id = 0l; } searchQuery = id + ""; onlyStatus = true; } else if (!uriString.contains("q=") && !uriString.contains("screen_name%3D")) { // going to try searching for users i guess String name = uriString.substring(uriString.indexOf(".com/")); name = name.replaceAll("/", "").replaceAll(".com", ""); searchQuery = name; onlyProfile = true; } else if (uriString.contains("q=")) { try { String search = uri.getQueryParameter("q"); if (search != null) { searchQuery = search; SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, MySuggestionsProvider.AUTHORITY, MySuggestionsProvider.MODE); if (searchQuery.contains("#")) { suggestions.saveRecentQuery(searchQuery.replaceAll("\"", ""), null); } else { suggestions.saveRecentQuery(searchQuery, null); } searchQuery += " -RT"; } else { searchQuery = ""; } } catch (Exception e) { } } else { try { String search = uriString; search = search.substring(search.indexOf("screen_name%3D") + 14); search = search.substring(0, search.indexOf("%")); if (search != null) { searchQuery = search; SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, MySuggestionsProvider.AUTHORITY, MySuggestionsProvider.MODE); if (searchQuery.contains("#")) { suggestions.saveRecentQuery(searchQuery.replaceAll("\"", ""), null); } else { suggestions.saveRecentQuery(searchQuery, null); } searchQuery += " -RT"; } else { searchQuery = ""; } onlyProfile = true; } catch (Exception e) { } } } }
From source file:com.klinker.android.twitter.ui.search.SearchPager.java
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { searchQuery = intent.getStringExtra(SearchManager.QUERY); SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, MySuggestionsProvider.AUTHORITY, MySuggestionsProvider.MODE); suggestions.saveRecentQuery(searchQuery, null); } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri uri = intent.getData();//from www . jav a 2 s . c o m String uriString = uri.toString(); if (uriString.contains("status/")) { long id; String replace = uriString.substring(uriString.indexOf("status")).replace("status/", "") .replaceAll("photo/*", ""); if (replace.contains("/")) { replace = replace.substring(0, replace.indexOf("/")); } else if (replace.contains("?")) { replace = replace.substring(0, replace.indexOf("?")); } try { id = Long.parseLong(replace); } catch (Exception e) { id = 0l; } searchQuery = id + ""; onlyStatus = true; } else if (!uriString.contains("q=") && !uriString.contains("screen_name%3D")) { // going to try searching for users i guess String name = uriString.substring(uriString.indexOf(".com/")); name = name.replaceAll("/", "").replaceAll(".com", ""); searchQuery = name; onlyProfile = true; Log.v("talon_searching", "only profile"); } else if (uriString.contains("q=")) { try { String search = uri.getQueryParameter("q"); if (search != null) { searchQuery = search; SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, MySuggestionsProvider.AUTHORITY, MySuggestionsProvider.MODE); suggestions.saveRecentQuery(searchQuery, null); } else { searchQuery = ""; } } catch (Exception e) { } } else { try { String search = uriString; search = search.substring(search.indexOf("screen_name%3D") + 14); search = search.substring(0, search.indexOf("%")); if (search != null) { searchQuery = search; SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, MySuggestionsProvider.AUTHORITY, MySuggestionsProvider.MODE); suggestions.saveRecentQuery(searchQuery, null); } else { searchQuery = ""; } onlyProfile = true; } catch (Exception e) { } } } }
From source file:com.google.android.demos.atom.app.FeedActivity.java
@Override protected void onNewIntent(Intent intent) { // This method is called when the search interface is used to specify a // different feed URL. The same activity instance is reused, so it needs // to be updated to show a different feed. You don't need to worry about // implementing this method unless you have set launchMode="singleTop". setIntent(intent);/* www. j a va2s .c o m*/ String action = intent.getAction(); if (Intent.ACTION_SEARCH.equals(action)) { String feedUrl = intent.getStringExtra(SearchManager.QUERY); if (Feeds.isValidFeedUrl(feedUrl)) { // Save this feed URL in the preferences, so that it will be // opened the next time the application is started. SharedPreferences.Editor editor = mPreferences.edit(); editor.putString(PREFERENCE_FEED, feedUrl); editor.commit(); } else { mInvalidUrl = feedUrl; showDialog(DIALOG_INVALID_URL); } } reload(); }
From source file:com.andrew.apollo.ui.activities.SearchActivity.java
/** * {@inheritDoc}// ww w .j a v a 2 s. c o m */ @Override protected void onNewIntent(final Intent intent) { super.onNewIntent(intent); final String query = intent.getStringExtra(SearchManager.QUERY); mFilterString = !TextUtils.isEmpty(query) ? query : null; // Set the prefix mAdapter.setPrefix(mFilterString); getSupportLoaderManager().restartLoader(0, null, this); }
From source file:org.fdroid.fdroid.FDroid.java
private void handleSearchOrAppViewIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); performSearch(query);//from ww w . j a va 2 s . c o m return; } final Uri data = intent.getData(); if (data == null) { return; } final String scheme = data.getScheme(); final String path = data.getPath(); String packageName = null; String query = null; if (data.isHierarchical()) { final String host = data.getHost(); if (host == null) { return; } switch (host) { case "f-droid.org": if (path.startsWith("/repository/browse")) { // http://f-droid.org/repository/browse?fdfilter=search+query query = UriCompat.getQueryParameter(data, "fdfilter"); // http://f-droid.org/repository/browse?fdid=packageName packageName = UriCompat.getQueryParameter(data, "fdid"); } else if (path.startsWith("/app")) { // http://f-droid.org/app/packageName packageName = data.getLastPathSegment(); if ("app".equals(packageName)) { packageName = null; } } break; case "details": // market://details?id=app.id packageName = UriCompat.getQueryParameter(data, "id"); break; case "search": // market://search?q=query query = UriCompat.getQueryParameter(data, "q"); break; case "play.google.com": if (path.startsWith("/store/apps/details")) { // http://play.google.com/store/apps/details?id=app.id packageName = UriCompat.getQueryParameter(data, "id"); } else if (path.startsWith("/store/search")) { // http://play.google.com/store/search?q=foo query = UriCompat.getQueryParameter(data, "q"); } break; case "apps": case "amazon.com": case "www.amazon.com": // amzn://apps/android?p=app.id // http://amazon.com/gp/mas/dl/android?s=app.id packageName = UriCompat.getQueryParameter(data, "p"); query = UriCompat.getQueryParameter(data, "s"); break; } } else if ("fdroid.app".equals(scheme)) { // fdroid.app:app.id packageName = data.getSchemeSpecificPart(); } else if ("fdroid.search".equals(scheme)) { // fdroid.search:query query = data.getSchemeSpecificPart(); } if (!TextUtils.isEmpty(query)) { // an old format for querying via packageName if (query.startsWith("pname:")) { packageName = query.split(":")[1]; } // sometimes, search URLs include pub: or other things before the query string if (query.contains(":")) { query = query.split(":")[1]; } } if (!TextUtils.isEmpty(packageName)) { Utils.debugLog(TAG, "FDroid launched via app link for '" + packageName + "'"); Intent intentToInvoke = new Intent(this, AppDetails.class); intentToInvoke.putExtra(AppDetails.EXTRA_APPID, packageName); startActivity(intentToInvoke); finish(); } else if (!TextUtils.isEmpty(query)) { Utils.debugLog(TAG, "FDroid launched via search link for '" + query + "'"); performSearch(query); } }
From source file:ca.zadrox.dota2esportticker.ui.TeamSearchActivity.java
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); Intent searchIntent = new Intent(UpdateTeamsService.ACTION_UPDATE_SEARCHED_TEAMS, null, this, UpdateTeamsService.class); searchIntent.putExtra(UpdateTeamsService.EXTRA_SEARCH_NAME, intent.getStringExtra(SearchManager.QUERY)); mQuery = intent.getStringExtra(SearchManager.QUERY); startService(searchIntent);/*from www.ja va 2 s. c om*/ }
From source file:com.ksharkapps.musicnow.ui.activities.SearchActivity.java
/** * {@inheritDoc}/*from w w w . jav a2 s .c o m*/ */ @Override protected void onNewIntent(final Intent intent) { super.onNewIntent(intent); final String query = intent.getStringExtra(SearchManager.QUERY); mFilterString = !TextUtils.isEmpty(query) ? query : null; // Set the prefix mAdapter.setPrefix(mFilterString); getLoaderManager().restartLoader(0, null, this); }
From source file:dev.drsoran.moloko.activities.TaskSearchResultActivity.java
@Override protected Fragment createTasksListFragment(Bundle config) { evaluateAndStoreQuery();/*from w w w . j a v a 2 s .com*/ if (getTopQuery().succeeded) { putTransformedQueryFromSmartFilter(config); return FullDetailedTasksListFragment.newInstance(config); } else { config = new Bundle(1); config.putString(SearchManager.QUERY, getQueryFromIntent()); return TaskSearchResultFailedFragment.newInstance(config); } }