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.deliciousdroid.fragment.MainSearchResultsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); base = (FragmentBaseActivity) getActivity(); base.setTitle(R.string.main_search_results_title); String[] MENU_ITEMS = new String[] { getString(R.string.search_results_bookmark), getString(R.string.search_results_tag), getString(R.string.search_results_global_tag) }; setListAdapter(new ArrayAdapter<String>(base, R.layout.main_view, MENU_ITEMS)); final Intent intent = base.getIntent(); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { if (intent.hasExtra(SearchManager.QUERY)) { Intent i = new Intent(base, MainSearchResultsFragment.class); i.putExtras(intent.getExtras()); startActivity(i);/* ww w .j av a 2s. c o m*/ base.finish(); } else { base.onSearchRequested(); } } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri data = intent.getData(); String path = null; String tagname = null; if (data != null) { path = data.getPath(); tagname = data.getQueryParameter("tagname"); } if (data.getScheme() == null || !data.getScheme().equals("content")) { Intent i = new Intent(Intent.ACTION_VIEW, data); startActivity(i); base.finish(); } else if (path.contains("bookmarks") && TextUtils.isDigitsOnly(data.getLastPathSegment())) { Intent viewBookmark = new Intent(base, ViewBookmark.class); viewBookmark.setData(data); Log.d("View Bookmark Uri", data.toString()); startActivity(viewBookmark); base.finish(); } else if (tagname != null) { Intent viewTags = new Intent(base, BrowseBookmarks.class); viewTags.setData(data); Log.d("View Tags Uri", data.toString()); startActivity(viewTags); base.finish(); } } ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (position == 0) { searchActionListener.onBookmarkSearch(); } else if (position == 1) { searchActionListener.onTagSearch(); } else if (position == 2) { searchActionListener.onGlobalTagSearch(); } } }); }
From source file:com.yeldi.yeldibazaar.SearchResults.java
@Override protected void onNewIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) mQuery = intent.getStringExtra(SearchManager.QUERY); super.onNewIntent(intent); updateView();/*from w w w. j av a2 s . com*/ }
From source file:koma.movieapp.ui.SearchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); Toolbar toolbar = getActionBarToolbar(); toolbar.setTitle(R.string.title_search); toolbar.setNavigationIcon(R.drawable.ic_up); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override/*from w w w . ja va 2 s . c o m*/ public void onClick(View view) { navigateUpToFromChild(SearchActivity.this, IntentCompat .makeMainActivity(new ComponentName(SearchActivity.this, PopularMoviesActivity.class))); } }); FragmentManager fm = getFragmentManager(); mMoviesFragment = (MoviesFragment) fm.findFragmentById(R.id.fragment_container); String query = getIntent().getStringExtra(SearchManager.QUERY); query = query == null ? "" : query; mQuery = query; if (mMoviesFragment == null) { mMoviesFragment = new MoviesFragment(); //Bundle args = intentToFragmentArguments(getIntent()); Bundle args = new Bundle(); args.putString("title", "Search"); args.putString("searchString", query); mMoviesFragment.setArguments(args); fm.beginTransaction().add(R.id.fragment_container, mMoviesFragment).commit(); } if (mSearchView != null) { mSearchView.setQuery(query, false); } overridePendingTransition(0, 0); }
From source file:com.dilyar.weather.app.MainActivity.java
@Override protected void onNewIntent(Intent intent) { Log.i(LOG_TAG, "onNewIntent()"); super.onNewIntent(intent); //Verify the action and get the query if (intent.getAction().equals(Intent.ACTION_SEARCH)) { String inputLocation = intent.getStringExtra(SearchManager.QUERY); //Download weather data from server SunshineSyncAdapter.syncImmediatelyWithLocationName(this, inputLocation); Log.d(LOG_TAG, "Got searching result: " + inputLocation + ". Start syncing"); Utility.saveCityNameToSP(this, inputLocation, true); mPagerAdapter.notifyDataSetChanged(); mViewPager.setCurrentItem(Utility.getCityNamesSize(this), false); if (Utility.getNotificationCity(this) == null) { Log.d(LOG_TAG, "MyNotification city was null, set it to new city: " + inputLocation); Utility.setNotificationCity(this, inputLocation, true); }//from w w w. j a v a 2s. c o m } }
From source file:com.rowland.movies.ui.activities.SearchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); // Inject all the views ButterKnife.bind(this); // Setup the inc_toolbar setToolbar(true, false, R.drawable.ic_logo_48px); if (findViewById(R.id.detail_container) != null) { // The detail container view will be present only in the large-screen layouts // (res/layout-sw600dp). If this view is present, then the activity should be // in two-pane mode. toggleShowTwoPane(true);//from w w w . j a v a2s.c o m // If we're being restored from a previous state, don't need to do anything // and should return or else we could end up with overlapping fragments. if (savedInstanceState != null) { return; } else { // Get Facebook Stetho doing its job initStetho(); // In two-pane mode, show the detail view in this activity by // adding or replacing the detail fragment using a fragment transaction. showDetailFragment(null); } } else { toggleShowTwoPane(false); } // Use this Bundle object Bundle args = new Bundle(); // to set arguments for this fragment args.putString(SearchManager.QUERY, getSearchQuery()); // Show the SearchFragment showSearchFragment(args); }
From source file:de.androvdr.fragments.TimersFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mListView = (ListView) mActivity.findViewById(android.R.id.list); /*//from w w w . ja v a2s . co m * setTheme doesn't change background color :( */ if (Preferences.blackOnWhite) mListView.setBackgroundColor(Color.WHITE); /* * perform epgsearch ? */ EpgSearch epgSearch = null; Intent intent = mActivity.getIntent(); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); epgSearch = new EpgSearch(); epgSearch.search = query.trim(); epgSearch.inTitle = Preferences.epgsearch_title; epgSearch.inSubtitle = Preferences.epgsearch_subtitle; epgSearch.inDescription = Preferences.epgsearch_description; TextView tv = (TextView) mActivity.findViewById(R.id.header_text); tv.setText(epgSearch.search); mIsSearch = true; } mController = new TimerController(mActivity, mHandler, mListView, epgSearch); mController.setOnTimerSelectedListener(this); mController.isSearch = mIsSearch; getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); if (mActivity.isDualPane()) { mUpdateSelectedItemThread = new UpdateSelectedItemThread() { @Override public int getPosition() { int position = mCurrentItemIndex; if (position == -1 && getListView().getCount() > 0) position = 0; return position; } }; } }
From source file:com.google.samples.apps.sergio.ui.SearchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); Toolbar toolbar = getActionBarToolbar(); toolbar.setTitle(R.string.title_search); toolbar.setNavigationIcon(R.drawable.ic_up); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override/*from w w w. j a v a2s .c o m*/ public void onClick(View view) { navigateUpToFromChild(SearchActivity.this, IntentCompat .makeMainActivity(new ComponentName(SearchActivity.this, BrowseSessionsActivity.class))); } }); FragmentManager fm = getFragmentManager(); mSessionsFragment = (SessionsFragment) fm.findFragmentById(R.id.fragment_container); String query = getIntent().getStringExtra(SearchManager.QUERY); query = query == null ? "" : query; mQuery = query; if (mSessionsFragment == null) { mSessionsFragment = new SessionsFragment(); Bundle args = intentToFragmentArguments( new Intent(Intent.ACTION_VIEW, ScheduleContract.Sessions.buildSearchUri(query))); mSessionsFragment.setArguments(args); fm.beginTransaction().add(R.id.fragment_container, mSessionsFragment).commit(); } if (mSearchView != null) { mSearchView.setQuery(query, false); } overridePendingTransition(0, 0); }
From source file:com.ratebeer.android.gui.Home.java
protected void handleStartIntent() { firstStart = false;// w ww . j av a 2 s . c o m // Start a search? if (getIntent().hasExtra(SearchManager.QUERY)) { load(SearchFragment_.builder().query(getIntent().getStringExtra(SearchManager.QUERY)).build()); return; } // See if some concrete action was requested (such as from the background poster service) String action = getIntent().getAction(); action = action == null ? "" : action; Uri data = getIntent().getData(); // Open details for some specific beer if (action.equals(Intent.ACTION_VIEW) && data != null) { List<String> segments = data.getPathSegments(); if (segments.size() > 1) { try { int beerId = Integer.parseInt(segments.get(1)); load(BeerViewFragment_.builder().beerId(beerId).build()); return; } catch (NumberFormatException e) { Log.d(com.ratebeer.android.gui.components.helpers.Log.LOG_NAME, "Invalid ACTION_VIEW Intent data; " + segments.get(1) + " is not a number."); } } } // Open the rating screen for a beer if (action.equals(PosterService.ACTION_EDITRATING)) { load(RateFragment_.buildFromExtras(getIntent().getExtras())); return; } // Open the add UPC code screen again; this assumes the UPC code is given in the extras if (action.equals(PosterService.ACTION_ADDUPCCODE)) { load(AddUpcCodeFragment_.builder().upcCode(getIntent().getStringExtra(PosterService.EXTRA_UPCCODE)) .build()); return; } // Open the beermails screen if (action.equals(BeermailService.ACTION_VIEWBEERMAILS)) { load(MailsFragment_.builder().build()); return; } // Open the beermail screen to a specific mail if (action.equals(BeermailService.ACTION_VIEWBEERMAIL)) { load(MailViewFragment_.buildFromExtras(getIntent().getExtras())); return; } // Open the beermail send mail screen to reply to a specific mail if (action.equals(BeermailService.ACTION_REPLYBEERMAIL)) { load(SendMailFragment.buildReplyFromExtras(getIntent().getExtras())); return; } // Open the beermail send mail screen to recover a failed send if (action.equals(PosterService.ACTION_SENDMAIL)) { load(SendMailFragment.buildFromFailedSend(getIntent().getExtras())); return; } // Normal startup; show dashboard load(DashboardFragment_.builder().build()); }
From source file:com.jackleeentertainment.oq.ui.layout.activity.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { 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_contactlist); // Check if two pane bool is set based on resource directories isTwoPaneLayout = false;// w w w . j a v a 2 s. com // 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 = App.getContext().getResources().getString(R.string.contacts_list_search_results_title) + " " + searchQuery; setTitle(title); } }
From source file:com.lokation.contacts2.ui.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { 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./*from ww w. j a v a 2 s.c o m*/ 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); } }