List of usage examples for android.content Intent ACTION_SEARCH
String ACTION_SEARCH
To view the source code for android.content Intent ACTION_SEARCH.
Click Source Link
From source file:com.deliciousdroid.fragment.BrowseBookmarkFeedFragment.java
public Loader<Cursor> onCreateLoader(int id, Bundle args) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); return new LoaderDrone(base, "global", query); } else if (username.equals("recent")) { return new LoaderDrone(base, "recent", null); } else if (username.equals("network")) { return new LoaderDrone(base, "network", null); } else {/*from w w w. ja v a 2 s . co m*/ return new LoaderDrone(base, username, tagname); } }
From source file:org.geometerplus.android.fbreader.BookmarkFragmentActivity.java
@Override protected void onNewIntent(Intent intent) { OrientationUtil.setOrientation(this, intent); if (!Intent.ACTION_SEARCH.equals(intent.getAction())) { return;//from w ww . j a v a 2 s .com } String pattern = intent.getStringExtra(SearchManager.QUERY); myBookmarkSearchPatternOption.setValue(pattern); final LinkedList<Bookmark> bookmarks = new LinkedList<Bookmark>(); pattern = pattern.toLowerCase(); for (Bookmark b : myAllBooksAdapter.bookmarks()) { if (MiscUtil.matchesIgnoreCase(b.getText(), pattern)) { bookmarks.add(b); } } if (!bookmarks.isEmpty()) { showSearchResultsTab(bookmarks); } else { UIUtil.showErrorMessage(this, "quoteNotFound"); } }
From source file:de.azapps.mirakel.new_ui.activities.MirakelActivity.java
private void handleIntent(final Intent intent) { if (intent == null) { return;// w w w . j av a2 s . co m } switch (intent.getAction()) { case DefinitionsHelper.SHOW_TASK: case DefinitionsHelper.SHOW_TASK_FROM_WIDGET: case DefinitionsHelper.SHOW_TASK_REMINDER: final Optional<Task> task = TaskHelper.getTaskFromIntent(intent); if (task.isPresent()) { setList(task.get().getList()); onTaskSelected(task.get()); } break; case Intent.ACTION_SEND: case Intent.ACTION_SEND_MULTIPLE: // TODO break; case DefinitionsHelper.SHOW_LIST: case DefinitionsHelper.SHOW_LIST_FROM_WIDGET: if (intent.hasExtra(DefinitionsHelper.EXTRA_LIST)) { setList((ListMirakel) intent.getParcelableExtra(DefinitionsHelper.EXTRA_LIST)); } else { Log.d(TAG, "show_list does not pass list, so ignore this"); } break; case Intent.ACTION_SEARCH: // TODO break; case DefinitionsHelper.ADD_TASK_FROM_WIDGET: // TODO break; case DefinitionsHelper.SHOW_MESSAGE: // TODO break; } }
From source file:ca.spencerelliott.mercury.Changesets.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); this.requestWindowFeature(Window.FEATURE_PROGRESS); this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.changesets); //Cancel any notifications previously setup NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nm.cancel(1);/*from w w w . ja v a 2 s .co m*/ //Create a new array list for the changesets changesets_list = new ArrayList<Map<String, ?>>(); changesets_data = new ArrayList<Beans.ChangesetBean>(); //Get the list view to store the changesets changesets_listview = (ListView) findViewById(R.id.changesets_list); TextView empty_text = (TextView) findViewById(R.id.changesets_empty_text); //Set the empty view changesets_listview.setEmptyView(empty_text); //Use a simple adapter to display the changesets based on the array list made earlier changesets_listview.setAdapter(new SimpleAdapter(this, changesets_list, R.layout.changeset_item, new String[] { COMMIT, FORMATTED_INFO }, new int[] { R.id.changesets_commit, R.id.changesets_info })); //Set the on click listener changesets_listview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterview, View view, int position, long id) { Intent intent = new Intent(Changesets.this, ChangesetViewer.class); //Pass the changeset information to the changeset viewer Bundle params = new Bundle(); params.putString("changeset_commit_text", changesets_data.get(position).getTitle()); params.putString("changeset_changes", changesets_data.get(position).getContent()); params.putLong("changeset_updated", changesets_data.get(position).getUpdated()); params.putString("changeset_authors", changesets_data.get(position).getAuthor()); params.putString("changeset_link", changesets_data.get(position).getLink()); //params.putBoolean("is_https", is_https); intent.putExtras(params); startActivity(intent); } }); //Register the list view for opening the context menu registerForContextMenu(changesets_listview); //Get the intent passed by the program if (getIntent() != null) { //Check to see if this is a search window if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { //Change the title of the activity and the empty text of the list so it looks like a search window this.setTitle(R.string.search_results_label); empty_text.setText(R.string.search_results_empty); //Retrieve the query the user entered String query = getIntent().getStringExtra(SearchManager.QUERY); //Convert the query to lower case query = query.toLowerCase(); //Retrieve the bundle data Bundle retrieved_data = getIntent().getBundleExtra(SearchManager.APP_DATA); //If the bundle was passed, grab the changeset data if (retrieved_data != null) { changesets_data = retrieved_data .getParcelableArrayList("ca.spencerelliott.mercury.SEARCH_DATA"); } //If we're missing changeset data, stop here if (changesets_data == null) return; //Create a new array list to store the changesets that were a match ArrayList<Beans.ChangesetBean> search_beans = new ArrayList<Beans.ChangesetBean>(); //Loop through each changeset for (Beans.ChangesetBean b : changesets_data) { //Check to see if any changesets match if (b.getTitle().toLowerCase().contains(query)) { //Get the title and date of the commit String commit_text = b.getTitle(); Date commit_date = new Date(b.getUpdated()); //Add a new changeset to display in the list view changesets_list.add(createChangeset( (commit_text.length() > 30 ? commit_text.substring(0, 30) + "..." : commit_text), b.getRevisionID() + " - " + commit_date.toLocaleString())); //Add this bean to the list of found search beans search_beans.add(b); } } //Switch the changeset data over to the changeset data that was a match changesets_data = search_beans; //Update the list in the activity list_handler.sendEmptyMessage(SUCCESSFUL); //Notify the activity that it is a search window is_search_window = true; //Stop loading here return; } //Get the data from the intent Uri data = getIntent().getData(); if (data != null) { //Extract the path in the intent String path_string = data.getEncodedPath(); //Split it by the forward slashes String[] split_path = path_string.split("/"); //Make sure a valid path was passed if (split_path.length == 3) { //Get the repository id from the intent repo_id = Long.parseLong(split_path[2].toString()); } else { //Notify the user if there was a problem Toast.makeText(this, R.string.invalid_intent, 1000).show(); } } } //Retrieve the changesets refreshChangesets(); }
From source file:com.murati.oszk.audiobook.ui.MusicPlayerActivity.java
protected void initializeFromParams(Bundle savedInstanceState, Intent intent) { String mediaId = null;//from w w w . j a v a 2s .c om String action = intent.getAction(); Bundle extras = intent.getExtras(); if (action != null) { switch (action) { case Intent.ACTION_SEARCH: case MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH: LogHelper.d(TAG, "Starting Search Handler"); mSearchParams = intent.getExtras(); mediaId = MediaIDHelper.createMediaID(mSearchParams.getString(SearchManager.QUERY), MediaIDHelper.MEDIA_ID_BY_SEARCH); LogHelper.d(TAG, "Search query=", mediaId); break; case Intent.ACTION_VIEW: if (extras != null) mediaId = extras.getString(MediaIDHelper.EXTRA_MEDIA_ID_KEY); LogHelper.d(TAG, "MediaId fetched=", mediaId); break; case Intent.ACTION_MAIN: default: break; } } else { if (savedInstanceState != null) { // If there is a saved media ID, use it mediaId = savedInstanceState.getString(MediaIDHelper.EXTRA_MEDIA_ID_KEY); } } navigateToBrowser(mediaId); }
From source file:org.bwgz.quotation.activity.HomeActivity.java
@Override public void startActivity(Intent intent) { Log.d(TAG, String.format("startActivity - intent: %s", intent)); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { intent.putExtra(SearchResultsActivity.EXTRA_SEARCH_TYPE, FreebaseSearch.SEARCH_TYPE_KEYWORD); }/* ww w . j a va 2 s. c o m*/ super.startActivity(intent); }
From source file:com.github.wakhub.monodict.activity.bean.ActivityHelper.java
public void searchOnMainActivity(String query) { Intent intent = MainActivity_.intent(activity).get(); intent.putExtra(SearchManager.QUERY, query); intent.setAction(Intent.ACTION_SEARCH); activity.startActivity(intent);// ww w . j a v a2 s . c o m }
From source file:com.klinker.android.twitter.activities.drawer_activities.discover.trends.SearchedTrendsActivity.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 {// w w w . j av a 2 s . co m suggestions.saveRecentQuery(searchQuery, null); } if (searchQuery.contains("#")) { // we want to add it to the userAutoComplete HashtagDataSource source = HashtagDataSource.getInstance(context); if (source != null) { source.deleteTag(searchQuery.replaceAll("\"", "")); source.createTag(searchQuery.replaceAll("\"", "")); } } if (!searchQuery.contains("-RT")) { searchQuery += " -RT"; } String query = searchQuery; doSearch(query); } }
From source file:com.klinker.android.twitter.ui.drawer_activities.discover.trends.SearchedTrendsActivity.java
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { searchQuery = intent.getStringExtra(SearchManager.QUERY); String query = searchQuery; doSearch(query);/*from w w w.j a va2 s. c om*/ SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, MySuggestionsProvider.AUTHORITY, MySuggestionsProvider.MODE); suggestions.saveRecentQuery(searchQuery, null); if (searchQuery.contains("#")) { // we want to add it to the userAutoComplete Log.v("talon_hashtag", "adding: " + searchQuery.replaceAll("\"", "")); HashtagDataSource source = HashtagDataSource.getInstance(context); if (source != null) { source.deleteTag(searchQuery.replaceAll("\"", "")); source.createTag(searchQuery.replaceAll("\"", "")); } } } }
From source file:de.janrenz.app.mediathek.MediathekActivity.java
/** if a user enters some text in the search field in the action bar **/ @Override/*from w w w . ja v a 2 s . c o m*/ public boolean onQueryTextSubmit(String query) { //lets close the input field if (mMenu != null) { MenuItem searchItem = mMenu.findItem(R.id.action_search); MenuItemCompat.collapseActionView(searchItem); // lets open up the search intent Intent i = new Intent(this, SearchActivity.class); i.setAction(Intent.ACTION_SEARCH); //add search string to our search activity i.putExtra(SearchManager.QUERY, query); startActivity(i); } return true; }