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.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 w w w . j a v a2 s .co m*/ return new LoaderDrone(getActivity(), username, tagname, feed, AccountHelper.getAccount(username, getActivity())); } }
From source file:com.todoroo.astrid.activity.TaskListActivity.java
/** * @see android.app.Activity#onCreate(Bundle) *//* ww w . j a v a 2s . co m*/ @Override protected void onCreate(Bundle savedInstanceState) { ThemeService.applyTheme(this); super.onCreate(savedInstanceState); DependencyInjectionService.getInstance().inject(this); int contentView = getContentView(); if (contentView == R.layout.task_list_wrapper_activity) swipeEnabled = true; setContentView(contentView); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(getHeaderView()); listsNav = actionBar.getCustomView().findViewById(R.id.lists_nav); listsNavDisclosure = (ImageView) actionBar.getCustomView().findViewById(R.id.list_disclosure_arrow); lists = (TextView) actionBar.getCustomView().findViewById(R.id.list_title); mainMenu = (ImageView) actionBar.getCustomView().findViewById(R.id.main_menu); personStatus = (TextView) actionBar.getCustomView().findViewById(R.id.person_image); commentsButton = (Button) actionBar.getCustomView().findViewById(R.id.comments); if (ThemeService.getTheme() == R.style.Theme_White_Alt) commentsButton.setTextColor(getResources().getColor(R.color.blue_theme_color)); initializeFragments(actionBar); createMainMenuPopover(); mainMenu.setOnClickListener(mainMenuClickListener); commentsButton.setOnClickListener(commentsButtonClickListener); personStatus.setOnClickListener(friendStatusClickListener); Bundle extras = getIntent().getExtras(); if (extras != null) extras = (Bundle) extras.clone(); if (extras == null) extras = new Bundle(); Filter savedFilter = getIntent().getParcelableExtra(TaskListFragment.TOKEN_FILTER); if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { String query = getIntent().getStringExtra(SearchManager.QUERY).trim(); String title = getString(R.string.FLA_search_filter, query); savedFilter = new Filter(title, title, new QueryTemplate().where(Task.TITLE.like("%" + //$NON-NLS-1$ query + "%")), //$NON-NLS-1$ null); } if (savedFilter == null) { savedFilter = getDefaultFilter(); extras.putAll(configureIntentAndExtrasWithFilter(getIntent(), savedFilter)); } extras.putParcelable(TaskListFragment.TOKEN_FILTER, savedFilter); if (swipeIsEnabled()) { setupPagerAdapter(); } setupTasklistFragmentWithFilter(savedFilter, extras); if (savedFilter != null) setListsTitle(savedFilter.title); if (getIntent().hasExtra(TOKEN_SOURCE)) { trackActivitySource(); } // Have to call this here because sometimes StartupService // isn't called (i.e. if the app was silently alive in the background) abTestEventReportingService.trackUserRetention(this); }
From source file:ch.kanti_baden.pu_marc_14b.traffictimewaste.SORT_TYPE.java
private void setupRecyclerViewAsync(@NonNull final ViewGroup viewGroup) { final ProgressDialog progressDialog = ProgressDialog.show(this, getResources().getString(R.string.progress_loading_posts), getResources().getString(R.string.progress_please_wait), true, false); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); DatabaseLink.DatabaseListener listener = new DatabaseLink.DatabaseListener() { @Override// www . j a v a2 s . co m void onGetResponse(String str) { final Post[] posts; try { JSONObject json = new JSONObject(str); posts = DatabaseLink.parseJson(json); } catch (JSONException e) { onError("JSON is invalid. Error: " + e.getMessage() + ", JSON: " + str); return; } if (progressDialog.isShowing()) progressDialog.dismiss(); final Post[] sortedPosts = sortPosts(posts); runOnUiThread(new Runnable() { @Override public void run() { // Inflate layout post_list View rootView = View.inflate(PostListActivity.this, R.layout.post_list, null); RecyclerView recyclerView = (RecyclerView) rootView.findViewById(R.id.post_list); // Setup refresh action SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) rootView .findViewById(R.id.swipe_refresh); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { recreate(); } }); // Set adapter with posts recyclerView.setAdapter(new SimpleItemRecyclerViewAdapter(sortedPosts)); // Add to ViewGroup viewGroup.addView(rootView); } }); } @Override void onError(String error) { if (progressDialog.isShowing()) progressDialog.dismiss(); new AlertDialog.Builder(progressDialog.getContext()).setTitle("Error").setMessage(error).show(); } }; Intent intent = getIntent(); if (Intent.ACTION_SEARCH.equals(intent.getAction())) DatabaseLink.instance.getPostsWithTag(listener, intent.getStringExtra(SearchManager.QUERY)); else DatabaseLink.instance.getAllPosts(listener); Log.v("TrafficTimeWaste", "Querying db..."); }
From source file:tw.idv.palatis.danboorugallery.PostListActivity.java
@Override protected void onNewIntent(final Intent intent) { super.onNewIntent(intent); if (intent.getAction() != null) { if (intent.getAction().equals(Intent.ACTION_VIEW)) { mDrawerLayout.post(new Runnable() { @Override/* w w w . j a v a 2 s .c om*/ public void run() { if (mPostListFragment == null) return; // FIXME: hard coded key int position = intent.getIntExtra("post_position", -1); if (position != -1) mPostListFragment.scrollGridToPosition(position); } }); } else if (intent.getAction().equals(Intent.ACTION_SEARCH)) { // FIXME: hard coded key SiteSession.submitFilterTags(intent.getStringExtra("tag")); } } }
From source file:com.battlelancer.seriesguide.ui.OverviewActivity.java
private void launchSearch() { // refine search with the show's title final Series show = DBUtils.getShow(this, mShowId); final String showTitle = show.getTitle(); Bundle appSearchData = new Bundle(); appSearchData.putString(EpisodeSearchFragment.InitBundle.SHOW_TITLE, showTitle); Intent intent = new Intent(this, SearchActivity.class); intent.putExtra(SearchManager.APP_DATA, appSearchData); intent.setAction(Intent.ACTION_SEARCH); startActivity(intent);//ww w . j a va 2 s . c o m }
From source file:org.transdroid.core.gui.search.SearchActivity.java
/** * Extracts the query string from the search {@link Intent} * @return The query string that was entered by the user */// ww w. ja v a 2 s . c o m private String parseQuery(Intent intent) { String query = null; if (intent.getAction().equals(Intent.ACTION_SEARCH)) { query = intent.getStringExtra(SearchManager.QUERY).trim(); } else if (intent.getAction().equals(Intent.ACTION_SEND)) { query = SendIntentHelper.cleanUpText(intent).trim(); } if (query != null && query.length() > 0) { // Remember this search query to later show as a suggestion suggestions.saveRecentQuery(query, null); return query; } return null; }
From source file:info.staticfree.android.units.Units.java
private void handleIntent(Intent intent) { final String action = intent.getAction(); if (Intent.ACTION_SEARCH.equals(action)) { final Intent pickUnit = new Intent(Intent.ACTION_PICK, UsageEntry.CONTENT_URI); final String query = intent.getExtras().getString(SearchManager.QUERY); pickUnit.putExtra(UnitList.EXTRA_UNIT_QUERY, query); startActivityForResult(pickUnit, REQUEST_PICK_UNIT); } else if (ACTION_USE_UNIT.equals(action)) { sendUnitAsSoftKeyboard(intent.getData()); }/*from w ww. j a v a 2 s . c o m*/ }
From source file:org.transdroid.gui.search.Search.java
/** * Extracts the query string from the search Intent * @return The string that was entered by the user */// w w w . jav a 2 s . c om private String getQuery(Intent intent) { // Extract string from Intent String query = null; if (intent.getAction().equals(Intent.ACTION_SEARCH)) { query = intent.getStringExtra(SearchManager.QUERY); } else if (intent.getAction().equals(Intent.ACTION_SEND)) { query = SendIntentHelper.cleanUpText(intent); } if (query != null && query.length() > 0) { // Remember this search query to later show as a suggestion suggestions.saveRecentQuery(query, null); return query; } return null; }
From source file:fr.kwiatkowski.apktrack.MainActivity.java
/** * This method received the intents passed to the activity and processes them. * @param i The intent to handle./*from w ww . ja v a2 s . com*/ */ private void _handle_intent(Intent i) { // The user wants to filter the list. if (Intent.ACTION_SEARCH.equals(i.getAction())) { Log.v(TAG, "User search: " + i.getStringExtra(SearchManager.QUERY)); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); boolean show_system = pref.getBoolean(SettingsFragment.KEY_PREF_SHOW_SYSTEM, false); String query = "%" + i.getStringExtra(SearchManager.QUERY) + "%"; String where_clause = "(_displayname LIKE ? OR _packagename LIKE ?)"; if (!show_system) { where_clause += " AND _systemapp = 0"; } List<InstalledApp> results = InstalledApp.find(InstalledApp.class, where_clause, query, query); Log.v(TAG, results.size() + " application(s) match."); if (results.size() == 0) // No apps match the search. { Toast.makeText(getApplicationContext(), R.string.search_no_result, Toast.LENGTH_SHORT).show(); return; } _app_display.filter_apps(results); } else if (Intent.ACTION_MANAGE_NETWORK_USAGE.equals(i.getAction())) { // Do not add to the backstack: back should return to the Intent sender. getSupportFragmentManager().beginTransaction().replace(R.id.container, new SettingsFragment()).commit(); } }
From source file:com.streaming.sweetplayer.MainActivity.java
private void handleIntent(Intent intent) { try {/* w w w . j a v a 2s . co m*/ if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); // Log.d(TAG, "Search: " + query); SearchFragment searchFragment = new SearchFragment(); addFragment(searchFragment); searchFragment.searchSongs(query); } } catch (Exception e) { e.printStackTrace(); } }