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.owncloud.android.ui.activity.ShareActivity.java
@Override protected void onNewIntent(Intent intent) { // Verify the action and get the query if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); Log_OC.w(TAG, "Ignored Intent requesting to query for " + query); } else if (UsersAndGroupsSearchProvider.ACTION_SHARE_WITH.equals(intent.getAction())) { Uri data = intent.getData();/*from w w w . j av a2 s.c o m*/ doShareWith(data.getLastPathSegment(), UsersAndGroupsSearchProvider.DATA_GROUP.equals(data.getAuthority())); } else { Log_OC.wtf(TAG, "Unexpected intent " + intent.toString()); } }
From source file:com.example.contactslist.ui.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode();/*from ww w. j a va 2 s .c om*/ } super.onCreate(savedInstanceState); // Set main content view. On smaller screen devices this is a single pane view with one // fragment. One larger screen devices this is a two pane view with two fragments. setContentView(R.layout.activity_main); // Check if two pane bool is set based on resource directories isTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes); // Check if this activity instance has been triggered as a result of a search query. This // will only happen on pre-HC OS versions as from HC onward search is carried out using // an ActionBar SearchView which carries out the search in-line without loading a new // Activity. if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { // Fetch query from intent and notify the fragment that it should display search // results instead of all contacts. String searchQuery = getIntent().getStringExtra(SearchManager.QUERY); ContactsListFragment mContactsListFragment = (ContactsListFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_list); // This flag notes that the Activity is doing a search, and so the result will be // search results rather than all contacts. This prevents the Activity and Fragment // from trying to a search on search results. isSearchResultView = true; mContactsListFragment.setSearchQuery(searchQuery); // Set special title for search results String title = getString(R.string.contacts_list_search_results_title, searchQuery); setTitle(title); } if (isTwoPaneLayout) { // If two pane layout, locate the contact detail fragment mContactDetailFragment = (ContactDetailFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_detail); } }
From source file:org.openmrs.client.activities.FindPatientsSearchActivity.java
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { searching = true;//from www .j a v a 2s. c o m lastSearchId++; mEmptyList.setVisibility(View.GONE); mPatientsListView.setEmptyView(mSpinner); mAdapter = new PatientArrayAdapter(this, R.layout.find_patients_row, new ArrayList<Patient>()); mPatientsListView.setAdapter(mAdapter); mLastQuery = intent.getStringExtra(SearchManager.QUERY); PatientCacheHelper.clearCache(); PatientCacheHelper.setId(lastSearchId); FindPatientsManager fpm = new FindPatientsManager(this); fpm.findPatient(mLastQuery, lastSearchId); if (mFindPatientMenuItem != null) { MenuItemCompat.collapseActionView(mFindPatientMenuItem); } } }
From source file:com.fastbootmobile.encore.app.SearchActivity.java
private void handleIntent(final Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { if (!intent.hasExtra(SearchManager.QUERY)) { Toast.makeText(this, "Invalid search query: missing query", Toast.LENGTH_SHORT).show(); } else {// w w w . ja va 2 s . c o m final String query = intent.getStringExtra(SearchManager.QUERY).trim(); mHandler.postDelayed(new Runnable() { @Override public void run() { mActiveFragment.resetResults(); mActiveFragment.setArguments(query); ProviderAggregator.getDefault().startSearch(query); } }, 200); SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, SearchSuggestionProvider.AUTHORITY, SearchSuggestionProvider.MODE); suggestions.saveRecentQuery(query, null); } } }
From source file:org.medankulinar.MixListView.java
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); doMixSearch(query);/*w w w . j a va2s .com*/ } }
From source file:org.adaway.ui.dialog.ActivityNotFoundDialogFragment.java
/** * Creates dialog/*from w ww . j a va 2s . co m*/ */ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final FragmentActivity activity = getActivity(); final String appGooglePlayUri = getArguments().getString(ARG_APP_GOOGLE_PLAY_URI); final String appFDroidQuery = getArguments().getString(ARG_APP_FDROID_QUERY); final int title = getArguments().getInt(ARG_TITLE); final int message = getArguments().getInt(ARG_MESSAGE); AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setPositiveButton(R.string.button_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intentGooglePlay = new Intent(Intent.ACTION_VIEW); intentGooglePlay.setData(Uri.parse(appGooglePlayUri)); try { activity.startActivity(intentGooglePlay); } catch (ActivityNotFoundException e) { Log.e(Constants.TAG, "No Google Play Store installed!, Trying FDroid...", e); Intent intentFDroid = new Intent(Intent.ACTION_SEARCH); intentFDroid.setComponent( new ComponentName("org.fdroid.fdroid", "org.fdroid.fdroid.SearchResults")); intentFDroid.putExtra(SearchManager.QUERY, appFDroidQuery); try { activity.startActivity(intentFDroid); } catch (ActivityNotFoundException e2) { Log.e(Constants.TAG, "No FDroid installed!", e2); } } } }); builder.setNegativeButton(R.string.button_no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); builder.setTitle(title); builder.setMessage(message); return builder.create(); }
From source file:org.openmrs.client.activities.FindActiveVisitsActivity.java
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { mQuery = intent.getStringExtra(SearchManager.QUERY); Intent searchIntent = new Intent(this, FindActiveVisitsSearchActivity.class); searchIntent.putExtra(SearchManager.QUERY, mQuery); startActivity(searchIntent);//from ww w.jav a2s . com intent.setAction(null); if (null != mFindVisitItem) { MenuItemCompat.collapseActionView(mFindVisitItem); } } }
From source file:org.sufficientlysecure.localcalendar.ui.ActivityNotFoundDialogFragment.java
/** * Creates dialog//from w ww. ja v a2 s. c om */ @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final FragmentActivity activity = getActivity(); final String appGooglePlayUri = getArguments().getString(ARG_APP_GOOGLE_PLAY_URI); final String appFDroidQuery = getArguments().getString(ARG_APP_FDROID_QUERY); final int title = getArguments().getInt(ARG_TITLE); final int message = getArguments().getInt(ARG_MESSAGE); AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intentGooglePlay = new Intent(Intent.ACTION_VIEW); intentGooglePlay.setData(Uri.parse(appGooglePlayUri)); try { activity.startActivity(intentGooglePlay); } catch (ActivityNotFoundException e) { Log.e(TAG, "No Google Play Store installed!, Trying FDroid...", e); Intent intentFDroid = new Intent(Intent.ACTION_SEARCH); intentFDroid.setComponent( new ComponentName("org.fdroid.fdroid", "org.fdroid.fdroid.SearchResults")); intentFDroid.putExtra(SearchManager.QUERY, appFDroidQuery); try { activity.startActivity(intentFDroid); } catch (ActivityNotFoundException e2) { Log.e(TAG, "No FDroid installed!", e2); } } } }); builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); builder.setTitle(title); builder.setMessage(message); return builder.create(); }
From source file:org.openmrs.mobile.activities.FindPatientsSearchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_find_patients); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mSpinner = (ProgressBar) findViewById(R.id.patientListViewLoading); mPatientsListView = (ListView) findViewById(R.id.patientListView); mEmptyList = (TextView) findViewById(R.id.emptyPatientListView); FontsUtil.setFont((ViewGroup) findViewById(android.R.id.content)); if (savedInstanceState != null) { mSearching = savedInstanceState.getBoolean(SEARCH_BUNDLE); mLastQuery = savedInstanceState.getString(LAST_QUERY_BUNDLE); mSearchedPatientsList = (ArrayList<Patient>) savedInstanceState.getSerializable(PATIENT_LIST_BUNDLE); }/*from ww w . j a v a 2 s . co m*/ if (mSearching) { mPatientsListView.setEmptyView(mSpinner); } else if (mSearchedPatientsList != null) { mAdapter = new PatientArrayAdapter(this, R.layout.find_patients_row, mSearchedPatientsList); mPatientsListView.setAdapter(mAdapter); mEmptyList.setText(getString(R.string.search_patient_no_result_for_query, mLastQuery)); mPatientsListView.setEmptyView(mEmptyList); } else if (getIntent().getAction() == null) { getIntent().setAction(Intent.ACTION_SEARCH); handleIntent(getIntent()); } }
From source file:mroza.forms.ChooseProgramActivity.java
@Override public void onResume() { super.onResume(); boolean bundleQueryExists = false; if ((savedState != null) && (savedState.containsKey("SEARCH_FILTER"))) bundleQueryExists = true;/* ww w . ja v a 2s. c o m*/ Intent intent = getIntent(); Term selectedTerm = getSelectedTerm(); //if called by search event perform search if (Intent.ACTION_SEARCH.equals(intent.getAction()) || bundleQueryExists) { clearFilters(true);//remove filter values - cannot use filter and search simultaneously if (Intent.ACTION_SEARCH.equals(intent.getAction())) { searchQuery = intent.getStringExtra(SearchManager.QUERY); } else { searchQuery = savedState.getString("SEARCH_FILTER"); savedState.remove("SEARCH_FILTER"); } List<ChildTable> queriedChildTables = ChildTablesRepository.getChildTablesByTermSelectedBySearch( ChooseProgramActivity.this, searchQuery, selectedTerm, child); handleListViewBehavior(queriedChildTables, selectedTerm); enableShowAllButton(true); intent.setAction(null); //clear search action return; } //if returning from child table view show all childTableList and clear filters List<ChildTable> childTables = ChildTablesRepository.getChildTableByTerm(ChooseProgramActivity.this, selectedTerm, child); handleListViewBehavior(childTables, selectedTerm); clearFilters(true); clearSearchField(); enableShowAllButton(false); }