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:info.guardianproject.gpg.KeyListFragment.java
public void handleIntent(String action, Bundle extras) { // Why doesn't java have default parameters :( if (extras == null) extras = new Bundle(); mCurrentAction = action;/*from w ww.j ava2s. com*/ mCurrentExtras = extras; String searchString = null; if (Intent.ACTION_SEARCH.equals(action)) { searchString = extras.getString(SearchManager.QUERY); if (searchString != null && searchString.trim().length() == 0) { searchString = null; } } long selectedKeyIds[] = null; selectedKeyIds = extras.getLongArray(Apg.EXTRA_SELECTION); if (selectedKeyIds == null) { Vector<Long> vector = new Vector<Long>(); for (int i = 0; i < mListView.getCount(); ++i) { if (mListView.isItemChecked(i)) { vector.add(mListView.getItemIdAtPosition(i)); } } selectedKeyIds = new long[vector.size()]; for (int i = 0; i < vector.size(); ++i) { selectedKeyIds[i] = vector.get(i); } } if (action.equals(Action.FIND_KEYS)) { if (mKeyserverAdapter == null) mKeyserverAdapter = new KeyListKeyserverAdapter(mListView, searchString); setListAdapter(mKeyserverAdapter); } else { mShowKeysAdapter = new KeyListContactsAdapter(mListView, action, searchString, selectedKeyIds); setListAdapter(mShowKeysAdapter); if (selectedKeyIds != null) { for (int i = 0; i < mShowKeysAdapter.getCount(); ++i) { long keyId = mShowKeysAdapter.getItemId(i); for (int j = 0; j < selectedKeyIds.length; ++j) { if (keyId == selectedKeyIds[j]) { mListView.setItemChecked(i, true); break; } } } } } }
From source file:com.dwdesign.tweetings.activity.SearchActivity.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Intent intent = getIntent(); mArguments.clear();/*from w w w .j a v a 2s .c o m*/ mData = intent.getData(); final boolean is_search_user = mData != null ? QUERY_PARAM_VALUE_USERS.equals(mData.getQueryParameter(QUERY_PARAM_TYPE)) : false; final String query = Intent.ACTION_SEARCH.equals(intent.getAction()) ? intent.getStringExtra(SearchManager.QUERY) : mData != null ? mData.getQueryParameter(QUERY_PARAM_QUERY) : null; int search_id = -1; if (mData != null && mData.getQueryParameter(QUERY_PARAM_ID) != null) { search_id = Integer.parseInt(mData.getQueryParameter(QUERY_PARAM_ID)); } if (query == null) { finish(); return; } if (savedInstanceState == null) { final SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, RecentSearchProvider.AUTHORITY, RecentSearchProvider.MODE); suggestions.saveRecentQuery(query, null); } mArguments.putString(INTENT_KEY_QUERY, query); mArguments.putInt(INTENT_KEY_ID, search_id); final String param_account_id = mData != null ? mData.getQueryParameter(QUERY_PARAM_ACCOUNT_ID) : null; if (param_account_id != null) { mArguments.putLong(INTENT_KEY_ACCOUNT_ID, parseLong(param_account_id)); } else { final String param_account_name = mData != null ? mData.getQueryParameter(QUERY_PARAM_ACCOUNT_NAME) : null; if (param_account_name != null) { mArguments.putLong(INTENT_KEY_ACCOUNT_ID, getAccountId(this, param_account_name)); } else { final long account_id = getDefaultAccountId(this); if (isMyAccount(this, account_id)) { mArguments.putLong(INTENT_KEY_ACCOUNT_ID, account_id); } else { finish(); return; } } } mActionBar = getSupportActionBar(); mActionBar.setCustomView(R.layout.base_tabs); mActionBar.setDisplayShowTitleEnabled(false); mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setDisplayShowCustomEnabled(true); final View view = mActionBar.getCustomView(); mProgress = (ProgressBar) view.findViewById(android.R.id.progress); mIndicator = (TabPageIndicator) view.findViewById(android.R.id.tabs); mAdapter = new TabsAdapter(this, getSupportFragmentManager(), mIndicator); mAdapter.setDisplayLabel(true); mAdapter.addTab(SearchTweetsFragment.class, mArguments, getString(R.string.search_tweets), R.drawable.ic_tab_twitter, 0); mAdapter.addTab(SearchUsersFragment.class, mArguments, getString(R.string.search_users), R.drawable.ic_tab_person, 1); mViewPager.setAdapter(mAdapter); mViewPager.setOffscreenPageLimit(1); mIndicator.setViewPager(mViewPager); mViewPager.setCurrentItem(is_search_user ? 1 : 0); }
From source file:com.android.mail.ui.TwoPaneController.java
@Override public boolean onCreate(Bundle savedState) { mActivity.setContentView(R.layout.two_pane_activity); mDrawerContainer = (DrawerLayout) mActivity.findViewById(R.id.drawer_container); mDrawerPullout = mDrawerContainer.findViewById(R.id.content_pane); mLayout = (TwoPaneLayout) mActivity.findViewById(R.id.two_pane_activity); if (mLayout == null) { // We need the layout for everything. Crash/Return early if it is null. LogUtils.wtf(LOG_TAG, "mLayout is null!"); return false; }/*ww w .j a v a 2s. c o m*/ mLayout.setController(this, Intent.ACTION_SEARCH.equals(mActivity.getIntent().getAction())); mLayout.setDrawerLayout(mDrawerContainer); if (savedState != null) { mSavedMiscellaneousView = savedState.getBoolean(SAVED_MISCELLANEOUS_VIEW, false); mMiscellaneousViewTransactionId = savedState.getInt(SAVED_MISCELLANEOUS_VIEW_TRANSACTION_ID, -1); } // 2-pane layout is the main listener of view mode changes, and issues secondary // notifications upon animation completion: // (onConversationVisibilityChanged, onConversationListVisibilityChanged) mViewMode.addListener(mLayout); return super.onCreate(savedState); }
From source file:org.tlhInganHol.android.klingonassistant.FloatingWindow.java
@Override public List<DropDownListItem> getDropDownItems(int id) { List<DropDownListItem> items = new ArrayList<DropDownListItem>(); items.add(new DropDownListItem(0, "Restore", new Runnable() { @Override//w w w. j av a2 s .c om public void run() { String query = mEditText.getText().toString(); Intent intent = new Intent(FloatingWindow.this, KlingonAssistant.class); // This needs to be set since this is called outside of an activity. intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Starting as a main intent is needed to force the menudrawer to load. intent.setAction(Intent.ACTION_MAIN); startActivity(intent); if (!query.equals("")) { intent.setAction(Intent.ACTION_SEARCH); intent.putExtra(SearchManager.QUERY, query); startActivity(intent); } } })); return items; }
From source file:net.vivekiyer.GAL.CorporateAddressBook.java
@Override protected void onNewIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); super.onNewIntent(intent); setIntent(intent);/*w ww . j a v a 2 s . com*/ if (Intent.ACTION_SEARCH.equals(intent.getAction())) { final String query = intent.getStringExtra(SearchManager.QUERY); performSearch(query); } }
From source file:com.thatkawaiiguy.meleehandbook.activity.SearchResultsActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.searchactivity, menu); ComponentName cn = new ComponentName(this, SearchResultsActivity.class); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.searchview)); searchView.onActionViewExpanded();/*from ww w .j a v a 2s . c om*/ if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { searchView.setQuery(getIntent().getStringExtra(SearchManager.QUERY).replaceAll("\\s+$", ""), false); searchView.setSearchableInfo(searchManager.getSearchableInfo(cn)); searchView.clearFocus(); } searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { if (!query.equals("")) search(query); searchView.clearFocus(); return false; } @Override public boolean onQueryTextChange(String newText) { if (!newText.equals("")) search(newText); return false; } }); return super.onCreateOptionsMenu(menu); }
From source file:net.zionsoft.obadiah.ui.activities.SearchActivity.java
private void handleStartIntent(Intent intent) { final String action = intent.getAction(); if (searchView != null && (SearchIntents.ACTION_SEARCH.equals(action) || Intent.ACTION_SEARCH.equals(action))) { final String query = intent.getStringExtra(SearchManager.QUERY); if (!TextUtils.isEmpty(query)) { searchView.setQuery(query, true); }//from ww w . j ava 2 s.c o m } }
From source file:com.zns.comicdroid.activity.Start.java
@Override protected void onNewIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); BaseListFragment fragment = getCurrentFragment(); if (fragment != null) { fragment.setFilter(query);//w ww . j a v a 2s. c o m } } }
From source file:com.xandy.calendar.SearchActivity.java
@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); // This needs to be created before setContentView mController = CalendarController.getInstance(this); mHandler = new Handler(); mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config); mShowEventDetailsWithAgenda = Utils.getConfigBool(this, R.bool.show_event_details_with_agenda); setContentView(R.layout.search);//from w w w . jav a 2s .c om setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); mContentResolver = getContentResolver(); if (mIsMultipane) { getActionBar().setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP); } else { getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME); } // Must be the first to register because this activity can modify the // list of event handlers in it's handle method. This affects who the // rest of the handlers the controller dispatches to are. mController.registerEventHandler(HANDLER_KEY, this); mDeleteEventHelper = new DeleteEventHelper(this, this, false /* don't exit when done */); long millis = 0; if (icicle != null) { // Returns 0 if key not found millis = icicle.getLong(BUNDLE_KEY_RESTORE_TIME); if (DEBUG) { Log.v(TAG, "Restore value from icicle: " + millis); } } if (millis == 0) { // Didn't find a time in the bundle, look in intent or current time millis = Utils.timeFromIntentInMillis(getIntent()); } Intent intent = getIntent(); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query; if (icicle != null && icicle.containsKey(BUNDLE_KEY_RESTORE_SEARCH_QUERY)) { query = icicle.getString(BUNDLE_KEY_RESTORE_SEARCH_QUERY); } else { query = intent.getStringExtra(SearchManager.QUERY); } if ("TARDIS".equalsIgnoreCase(query)) { Utils.tardis(); } initFragments(millis, query); } }
From source file:de.janrenz.app.mediathek.SearchActivity.java
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = mQuery = intent.getStringExtra(SearchManager.QUERY); doSearch(query);/* w w w .ja va2 s .c o m*/ } }