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.rowland.hashtrace.ui.fragments.SearchFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Bundle arguments = getArguments();//from ww w. ja v a 2s . c om if (arguments != null && arguments.containsKey(SearchManager.QUERY)) { /** * Use this query to display search results like 1. Getting the data * from SQLite and showing in listview 2. Making webrequest and * displaying the data For now we just display the query only */ Bundle data = new Bundle(); data.putString(SearchManager.QUERY, mQuery); getLoaderManager().initLoader(SEARCH_LOADER, data, this); } }
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 {//from ww w.jav 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:us.phyxsi.gameshelf.ui.SearchActivity.java
@Override protected void onNewIntent(Intent intent) { if (intent.hasExtra(SearchManager.QUERY)) { String query = intent.getStringExtra(SearchManager.QUERY); if (!TextUtils.isEmpty(query)) { searchView.setQuery(query, false); getByTitle(query);//from ww w . jav a2s. co m } } }
From source file:inc.bait.jubilee.ui.fragments.ContactsListFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (!TextUtils.isEmpty(searchString)) { outState.putString(SearchManager.QUERY, searchString); outState.putInt(STATE_PREVIOUSLY_SELECTED_KEY, getListView().getCheckedItemPosition()); }//from w ww . jav a 2s.co m }
From source file:com.aboveware.sms.ui.MessageSearchResultActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); String searchStringParameter = getIntent().getStringExtra(SearchManager.QUERY); searchString = searchStringParameter != null ? searchStringParameter.trim() : ""; setContentView(R.layout.search_activity); final ListView listView = getListView(); listView.setItemsCanFocus(true);/*from w w w. ja v a 2 s . co m*/ listView.setFocusable(true); listView.setClickable(true); // Create an empty adapter we will use to display the loaded data. suggestionAdapter = new SuggestionListAdapter(this, null); setListAdapter(suggestionAdapter); getSupportLoaderManager().initLoader(0, null, this); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); }
From source file:com.dsdar.thosearoundme.util.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 . ja va2s .com // Create the main contacts adapter mAdapter = new ContactsAdapter(getActivity()); itsContext = this.getActivity(); itsContactListActivity = new ContactsListActivity(); itsSharedPreference = itsContext.getApplicationContext().getSharedPreferences(MyAppConstants.APP_PREFERENCE, itsContactListActivity.MODE_PRIVATE); itsContactsList = new ArrayList<Contact>(); 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.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 ww w. j a v a2 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 .j a va2 s. c om 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; }
From source file:util.mediamanager.PlaylistUtils.java
public static void ListMediaButtonReceivers(Context context, String query) { try {//from www . jav a 2 s . c o m final Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON); PackageManager packageManager = context.getPackageManager(); List<ResolveInfo> mediaReceivers = packageManager.queryBroadcastReceivers(mediaButtonIntent, PackageManager.GET_INTENT_FILTERS | PackageManager.GET_RESOLVED_FILTER); for (int i = mediaReceivers.size() - 1; i >= 0; i--) { ResolveInfo mediaReceiverResolveInfo = mediaReceivers.get(i); String name = mediaReceiverResolveInfo.activityInfo.applicationInfo.sourceDir + ", " + mediaReceiverResolveInfo.activityInfo.name; String cn = mediaReceiverResolveInfo.resolvePackageName; String cn1 = mediaReceiverResolveInfo.activityInfo.toString(); Log.d(Constants.APP.TAG, "resolvePackageName media receivers = " + cn); Log.d(Constants.APP.TAG, "activityInfo = " + cn1); } mediaButtonIntent.setAction(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH); //mediaButtonIntent.setComponent(new ComponentName("com.spotify.music", "com.spotify.music.MainActivity")); mediaButtonIntent.putExtra(SearchManager.QUERY, "GM1"); mediaButtonIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(mediaButtonIntent); } catch (ActivityNotFoundException e) { Log.e(Constants.APP.TAG, "Error searching Spotify w/ query '" + query + "'"); //Toast.makeText(mRideManager.mAppContext, String.format("Error parsing query \"%s\"", query), Toast.LENGTH_SHORT).show(); e.printStackTrace(); } }
From source file:com.pindroid.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(getActivity(), username, query, feed, AccountHelper.getAccount(username, getActivity())); } else {/*from ww w. j a v a 2 s. c o m*/ return new LoaderDrone(getActivity(), username, tagname, feed, AccountHelper.getAccount(username, getActivity())); } }