List of usage examples for android.app SearchManager EXTRA_DATA_KEY
String EXTRA_DATA_KEY
To view the source code for android.app SearchManager EXTRA_DATA_KEY.
Click Source Link
From source file:com.songcode.materialnotes.ui.NoteEditActivity.java
private boolean initActivityState(Intent intent) { /**//from w w w . j a v a2 s. c o m * If the user specified the {@link Intent#ACTION_VIEW} but not provided with id, * then jump to the NotesListActivity */ mWorkingNote = null; if (TextUtils.equals(Intent.ACTION_VIEW, intent.getAction())) { long noteId = intent.getLongExtra(Intent.EXTRA_UID, 0); mUserQuery = ""; /** * Starting from the searched result */ if (intent.hasExtra(SearchManager.EXTRA_DATA_KEY)) { noteId = Long.parseLong(intent.getStringExtra(SearchManager.EXTRA_DATA_KEY)); mUserQuery = intent.getStringExtra(SearchManager.USER_QUERY); } if (!DataUtils.visibleInNoteDatabase(getContentResolver(), noteId, Notes.TYPE_NOTE)) { Intent jump = new Intent(this, NotesListActivity.class); startActivity(jump); showToast(R.string.error_note_not_exist); finish(); return false; } else { mWorkingNote = WorkingNote.load(this, noteId); if (mWorkingNote == null) { Log.e(TAG, "load note failed with note id" + noteId); finish(); return false; } } } else if (TextUtils.equals(Intent.ACTION_INSERT_OR_EDIT, intent.getAction())) { // New note long folderId = intent.getLongExtra(Notes.INTENT_EXTRA_FOLDER_ID, 0); int widgetId = intent.getIntExtra(Notes.INTENT_EXTRA_WIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); int widgetType = intent.getIntExtra(Notes.INTENT_EXTRA_WIDGET_TYPE, Notes.TYPE_WIDGET_INVALIDE); int bgResId = intent.getIntExtra(Notes.INTENT_EXTRA_BACKGROUND_ID, ResourceParser.getDefaultBgId(this)); // Parse call-record note String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); long callDate = intent.getLongExtra(Notes.INTENT_EXTRA_CALL_DATE, 0); if (callDate != 0 && phoneNumber != null) { if (TextUtils.isEmpty(phoneNumber)) { Log.w(TAG, "The call record number is null"); } long noteId = 0; if ((noteId = DataUtils.getNoteIdByPhoneNumberAndCallDate(getContentResolver(), phoneNumber, callDate)) > 0) { mWorkingNote = WorkingNote.load(this, noteId); if (mWorkingNote == null) { Log.e(TAG, "load call note failed with note id" + noteId); finish(); return false; } } else { mWorkingNote = WorkingNote.createEmptyNote(this, folderId, widgetId, widgetType, bgResId); mWorkingNote.convertToCallNote(phoneNumber, callDate); } } else { mWorkingNote = WorkingNote.createEmptyNote(this, folderId, widgetId, widgetType, bgResId); } } else { Log.e(TAG, "Intent not specified action, should not support"); finish(); return false; } getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); mWorkingNote.setOnSettingStatusChangedListener(this); return true; }
From source file:com.berniesanders.fieldthebern.MainActivity.java
private void handleIntent(Intent intent) { if (Actions.SEARCH_SELECTION_PAGE.equals(intent.getAction())) { String title = intent.getExtras().getString(SearchManager.EXTRA_DATA_KEY); showPage(title);/*from w w w .jav a 2 s.co m*/ MenuItemCompat.collapseActionView(this.menu.findItem(R.id.menu_search)); } else if (Actions.SEARCH_SELECTION_COLLECTION.equals(intent.getAction())) { String title = intent.getExtras().getString(SearchManager.EXTRA_DATA_KEY); showCollection(title); MenuItemCompat.collapseActionView(this.menu.findItem(R.id.menu_search)); } }
From source file:com.ht.app.RestaurantsActivity.java
private void handleIntent(Intent intent) { if (intent == null || intent.getAction() == null) return;//w ww .ja v a2 s .c o m if (intent.getAction().equals(Intent.ACTION_SEARCH)) { doSearch(intent.getStringExtra(SearchManager.QUERY)); } else if (intent.getAction().equals(Intent.ACTION_VIEW)) { getPlace(intent.getStringExtra(SearchManager.EXTRA_DATA_KEY)); } }
From source file:android.support.v7.widget.SearchView.java
/** * Constructs an intent from the given information and the search dialog state. * * @param action Intent action./*from www. j av a 2 s . co m*/ * @param data Intent data, or <code>null</code>. * @param extraData Data for {@link SearchManager#EXTRA_DATA_KEY} or <code>null</code>. * @param query Intent query, or <code>null</code>. * @param actionKey The key code of the action key that was pressed, * or {@link KeyEvent#KEYCODE_UNKNOWN} if none. * @param actionMsg The message for the action key that was pressed, * or <code>null</code> if none. * @return The intent. */ private Intent createIntent(String action, Uri data, String extraData, String query, int actionKey, String actionMsg) { // Now build the Intent Intent intent = new Intent(action); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // We need CLEAR_TOP to avoid reusing an old task that has other activities // on top of the one we want. We don't want to do this in in-app search though, // as it can be destructive to the activity stack. if (data != null) { intent.setData(data); } intent.putExtra(SearchManager.USER_QUERY, mUserQuery); if (query != null) { intent.putExtra(SearchManager.QUERY, query); } if (extraData != null) { intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData); } if (mAppSearchData != null) { intent.putExtra(SearchManager.APP_DATA, mAppSearchData); } if (actionKey != KeyEvent.KEYCODE_UNKNOWN) { intent.putExtra(SearchManager.ACTION_KEY, actionKey); intent.putExtra(SearchManager.ACTION_MSG, actionMsg); } if (IS_AT_LEAST_FROYO) { intent.setComponent(mSearchable.getSearchActivity()); } return intent; }
From source file:cm.aptoide.com.actionbarsherlock.widget.SearchView.java
/** * Constructs an intent from the given information and the search dialog state. * * @param action Intent action.//from w w w . j a va 2s . c o m * @param data Intent data, or <code>null</code>. * @param extraData Data for {@link SearchManager#EXTRA_DATA_KEY} or <code>null</code>. * @param query Intent query, or <code>null</code>. * @param actionKey The key code of the action key that was pressed, * or {@link KeyEvent#KEYCODE_UNKNOWN} if none. * @param actionMsg The message for the action key that was pressed, * or <code>null</code> if none. * @return The intent. */ private Intent createIntent(String action, Uri data, String extraData, String query, int actionKey, String actionMsg) { // Now build the Intent Intent intent = new Intent(action); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // We need CLEAR_TOP to avoid reusing an old task that has other activities // on top of the one we want. We don't want to do this in in-app search though, // as it can be destructive to the activity stack. if (data != null) { intent.setData(data); } intent.putExtra(SearchManager.USER_QUERY, mUserQuery); if (query != null) { intent.putExtra(SearchManager.QUERY, query); } if (extraData != null) { intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData); } if (mAppSearchData != null) { intent.putExtra(SearchManager.APP_DATA, mAppSearchData); } if (actionKey != KeyEvent.KEYCODE_UNKNOWN) { intent.putExtra(SearchManager.ACTION_KEY, actionKey); intent.putExtra(SearchManager.ACTION_MSG, actionMsg); } intent.setComponent(mSearchable.getSearchActivity()); return intent; }
From source file:com.example.navigationsearchview.NavigationSearchView.java
/** * Constructs an intent from the given information and the search dialog * state.// www . j av a 2s. c o m * * @param action * Intent action. * @param data * Intent data, or <code>null</code>. * @param extraData * Data for {@link SearchManager#EXTRA_DATA_KEY} or * <code>null</code>. * @param query * Intent query, or <code>null</code>. * @param actionKey * The key code of the action key that was pressed, or * {@link KeyEvent#KEYCODE_UNKNOWN} if none. * @param actionMsg * The message for the action key that was pressed, or * <code>null</code> if none. * @return The intent. */ private Intent createIntent(String action, Uri data, String extraData, String query, int actionKey, String actionMsg) { // Now build the Intent Intent intent = new Intent(action); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // We need CLEAR_TOP to avoid reusing an old task that has other // activities // on top of the one we want. We don't want to do this in in-app search // though, // as it can be destructive to the activity stack. if (data != null) { intent.setData(data); } intent.putExtra(SearchManager.USER_QUERY, mUserQuery); if (query != null) { intent.putExtra(SearchManager.QUERY, query); } if (extraData != null) { intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData); } if (mAppSearchData != null) { intent.putExtra(SearchManager.APP_DATA, mAppSearchData); } if (actionKey != KeyEvent.KEYCODE_UNKNOWN) { intent.putExtra(SearchManager.ACTION_KEY, actionKey); intent.putExtra(SearchManager.ACTION_MSG, actionMsg); } if (IS_AT_LEAST_FROYO) { intent.setComponent(mSearchable.getSearchActivity()); } return intent; }
From source file:com.tandong.sa.sherlock.widget.SearchView.java
/** * Constructs an intent from the given information and the search dialog * state./* www . j av a 2s. c om*/ * * @param action * Intent action. * @param data * Intent data, or <code>null</code>. * @param extraData * Data for {@link SearchManager#EXTRA_DATA_KEY} or * <code>null</code>. * @param query * Intent query, or <code>null</code>. * @param actionKey * The key code of the action key that was pressed, or * {@link KeyEvent#KEYCODE_UNKNOWN} if none. * @param actionMsg * The message for the action key that was pressed, or * <code>null</code> if none. * @return The intent. */ private Intent createIntent(String action, Uri data, String extraData, String query, int actionKey, String actionMsg) { // Now build the Intent Intent intent = new Intent(action); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // We need CLEAR_TOP to avoid reusing an old task that has other // activities // on top of the one we want. We don't want to do this in in-app search // though, // as it can be destructive to the activity stack. if (data != null) { intent.setData(data); } intent.putExtra(SearchManager.USER_QUERY, mUserQuery); if (query != null) { intent.putExtra(SearchManager.QUERY, query); } if (extraData != null) { intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData); } if (mAppSearchData != null) { intent.putExtra(SearchManager.APP_DATA, mAppSearchData); } if (actionKey != KeyEvent.KEYCODE_UNKNOWN) { intent.putExtra(SearchManager.ACTION_KEY, actionKey); intent.putExtra(SearchManager.ACTION_MSG, actionMsg); } intent.setComponent(mSearchable.getSearchActivity()); return intent; }