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.android.eventspace.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; }// w w w . j a v a 2 s . c om // Handle action buttons switch (item.getItemId()) { case R.id.action_websearch: // create intent to perform web search for this planet Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getActionBar().getTitle()); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:org.addhen.smssync.presentation.view.ui.activity.MainActivity.java
private void handleSearchIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); query = query == null ? "" : query; mQuery = query;/*from ww w . ja v a2s .c om*/ performQuery(query); if (mSearchView != null) { mSearchView.setQuery(query, false); } } }
From source file:org.bwgz.quotation.activity.SearchResultsActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { Log.d(TAG, String.format("onCreateOptionsMenu - menu: %s", menu)); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.options_menu, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); Intent intent = getIntent();/*w ww . j ava 2s. c o m*/ if (intent != null) { int type = intent.getIntExtra(EXTRA_SEARCH_TYPE, FreebaseSearch.SEARCH_TYPE_KEYWORD); Log.d(TAG, String.format("onCreateOptionsMenu - type: %s", type)); setSearchHint(menu, type); String query = intent.getStringExtra(SearchManager.QUERY); Log.d(TAG, String.format("onCreateOptionsMenu - query: %s", query)); if (query != null) { searchView.setIconified(true); searchView.setQuery(query, false); searchView.clearFocus(); } } return true; }
From source file:com.svpino.longhorn.activities.DashboardActivity.java
private void handleIntent(Intent intent) { if (Intent.ACTION_VIEW.equals(intent.getAction())) { try {//from w ww . ja va 2 s . com String symbol = intent.getData().getLastPathSegment(); addStockToWatchList(symbol); } catch (Throwable t) { Log.e(LOG_TAG, "Error while handling Intent.ACTION_VIEW.", t); } } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) { performSearch(intent.getStringExtra(SearchManager.QUERY)); } }
From source file:fr.shywim.antoinedaniel.ui.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Crashlytics not initialized, only safe code mContext = this; Fabric.with(this, new Crashlytics()); Crashlytics.setUserIdentifier(Installation.id(this)); // Crashlytics initialized, can start doing "unsafe" code AnalyticsUtils.initAnalyticsTracker(getApplicationContext()); mHandler = new Handler(); mAppContext = this.getApplicationContext(); utils = Utils.getInstance();//from w ww .j a v a 2 s . c o m setVolumeControlStream(AudioManager.STREAM_MUSIC); setContentView(R.layout.activity_main); Intent intent = getIntent(); if (SearchIntents.ACTION_SEARCH.equals(intent.getAction())) { searchQuery = intent.getStringExtra(SearchManager.QUERY); } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); } attachTaskFragment(); appState = AppState.getInstance(); appState.load(this); }
From source file:util.mediamanager.PlaylistUtils.java
public static void PlayGMPlaylistUsingSearch(Context context, String playlist) { Intent intent = new Intent(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH); intent.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, MediaStore.Audio.Playlists.ENTRY_CONTENT_TYPE); intent.putExtra(SearchManager.QUERY, playlist); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); if (intent.resolveActivity(context.getPackageManager()) != null) { context.startActivity(intent);//from w w w . j a v a2 s .c om } }
From source file:com.jackleeentertainment.oq.ui.layout.fragment.ContactsListFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Check if this fragment is part of a two-pane set up or a single pane by reading a // boolean from the application resource directories. This lets allows us to easily specify // which screen sizes should use a two-pane layout by setting this boolean in the // corresponding resource size-qualified directory. mIsTwoPaneLayout = false;/*from w w w . j a v a 2 s. co m*/ // Let this fragment contribute menu items setHasOptionsMenu(true); // Create the main contacts adapter mAdapter = new ContactsAdapter(getActivity()); if (savedInstanceState != null) { // If we're restoring state after this fragment was recreated then // retrieve previous search term and previously selected search // result. mSearchTerm = savedInstanceState.getString(SearchManager.QUERY); mPreviouslySelectedSearchItem = savedInstanceState.getInt(STATE_PREVIOUSLY_SELECTED_KEY, 0); } /* * An ImageLoader object loads and resizes an image in the background and binds it to the * QuickContactBadge in each item layout of the ListView. ImageLoader implements memory * caching for each image, which substantially improves refreshes of the ListView as the * user scrolls through it. * * To learn more about downloading images asynchronously and caching the results, read the * Android training class Displaying Bitmaps Efficiently. * * http://developer.android.com/training/displaying-bitmaps/ */ mImageLoader = new ImageLoader(getActivity(), getListPreferredItemHeight()) { @Override protected Bitmap processBitmap(Object data) { // This gets called in a background thread and passed the data from // ImageLoader.loadImage(). return loadContactPhotoThumbnail((String) data, getImageSize()); } }; // Set a placeholder loading image for the image loader mImageLoader.setLoadingImage(R.drawable.ic_contact_picture_holo_light); // Add a cache to the image loader mImageLoader.addImageCache(getActivity().getSupportFragmentManager(), 0.1f); }
From source file:com.fitforbusiness.contact.ContactsListFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Check if this fragment is part of a two-pane set up or a single pane by reading a // boolean from the application resource directories. This lets allows us to easily specify // which screen sizes should use a two-pane layout by setting this boolean in the // corresponding resource size-qualified directory. mIsTwoPaneLayout = false;//from w ww. j av a2 s .c o m // Let this fragment contribute menu items setHasOptionsMenu(true); // Create the main contacts adapter mAdapter = new ContactsAdapter(getActivity()); if (savedInstanceState != null) { // If we're restoring state after this fragment was recreated then // retrieve previous search term and previously selected search // result. mSearchTerm = savedInstanceState.getString(SearchManager.QUERY); mPreviouslySelectedSearchItem = savedInstanceState.getInt(STATE_PREVIOUSLY_SELECTED_KEY, 0); } /** * An ImageLoader object loads and resizes an image in the background and binds it to the * QuickContactBadge in each item layout of the ListView. ImageLoader implements memory * caching for each image, which substantially improves refreshes of the ListView as the * user scrolls through it. * * To learn more about downloading images asynchronously and caching the results, read the * Android training class Displaying Bitmaps Efficiently. * * http://developer.android.com/training/displaying-bitmaps/ */ mImageLoader = new ImageLoader(getActivity(), getListPreferredItemHeight()) { @Override protected Bitmap processBitmap(Object data) { // This gets called in a background thread and passed the data from // ImageLoader.loadImage(). return loadContactPhotoThumbnail((String) data, getImageSize()); } }; // Set a placeholder loading image for the image loader mImageLoader.setLoadingImage(R.drawable.ic_contact_picture_holo_light); // Add a cache to the image loader mImageLoader.addImageCache(getActivity().getSupportFragmentManager(), 0.1f); }
From source file:com.ces.cloudnote.app.contactslist.ContactsListFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Check if this fragment is part of a two-pane set up or a single pane by reading a // boolean from the application resource directories. This lets allows us to easily specify // which screen sizes should use a two-pane layout by setting this boolean in the // corresponding resource size-qualified directory. mIsTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes); // Let this fragment contribute menu items setHasOptionsMenu(true);//from w w w . ja v a 2 s.co m // Create the main contacts adapter mAdapter = new ContactsAdapter(getActivity()); if (savedInstanceState != null) { // If we're restoring state after this fragment was recreated then // retrieve previous search term and previously selected search // result. mSearchTerm = savedInstanceState.getString(SearchManager.QUERY); mPreviouslySelectedSearchItem = savedInstanceState.getInt(STATE_PREVIOUSLY_SELECTED_KEY, 0); } /* * An ImageLoader object loads and resizes an image in the background and binds it to the * QuickContactBadge in each item layout of the ListView. ImageLoader implements memory * caching for each image, which substantially improves refreshes of the ListView as the * user scrolls through it. * * To learn more about downloading images asynchronously and caching the results, read the * Android training class Displaying Bitmaps Efficiently. * * http://developer.android.com/training/displaying-bitmaps/ */ mImageLoader = new ImageLoader(getActivity(), getListPreferredItemHeight()) { @Override protected Bitmap processBitmap(Object data) { // This gets called in a background thread and passed the data from // ImageLoader.loadImage(). return loadContactPhotoThumbnail((String) data, getImageSize()); } }; // Set a placeholder loading image for the image loader mImageLoader.setLoadingImage(R.drawable.ic_contact_picture_holo_light); // Add a cache to the image loader mImageLoader.addImageCache(getActivity().getSupportFragmentManager(), 0.1f); }
From source file:android.com.example.contactslist.ui.ContactsListFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Check if this fragment is part of a two-pane set up or a single pane by reading a // boolean from the application resource directories. This lets allows us to easily specify // which screen sizes should use a two-pane layout by setting this boolean in the // corresponding resource size-qualified directory. //mIsTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes ); // Let this fragment contribute menu items setHasOptionsMenu(true);//ww w. j ava2s. c o m // Create the main contacts adapter mAdapter = new ContactsAdapter(getActivity()); if (savedInstanceState != null) { // If we're restoring state after this fragment was recreated then // retrieve previous search term and previously selected search // result. mSearchTerm = savedInstanceState.getString(SearchManager.QUERY); mPreviouslySelectedSearchItem = savedInstanceState.getInt(STATE_PREVIOUSLY_SELECTED_KEY, 0); } /* * An ImageLoader object loads and resizes an image in the background and binds it to the * QuickContactBadge in each item layout of the ListView. ImageLoader implements memory * caching for each image, which substantially improves refreshes of the ListView as the * user scrolls through it. * * To learn more about downloading images asynchronously and caching the results, read the * Android training class Displaying Bitmaps Efficiently. * * http://developer.android.com/training/displaying-bitmaps/ */ mImageLoader = new ImageLoader(getActivity(), getListPreferredItemHeight()) { @Override protected Bitmap processBitmap(Object data) { // This gets called in a background thread and passed the data from // ImageLoader.loadImage(). return loadContactPhotoThumbnail((String) data, getImageSize()); } }; // Set a placeholder loading image for the image loader mImageLoader.setLoadingImage(R.drawable.ic_contact_picture_holo_light); // Add a cache to the image loader mImageLoader.addImageCache(getActivity().getSupportFragmentManager(), 0.1f); }