List of usage examples for android.content Intent getLongExtra
public long getLongExtra(String name, long defaultValue)
From source file:ch.uzh.supersede.feedbacklibrary.FeedbackActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_feedback); UserManager userManager = (UserManager) getApplicationContext().getSystemService(Context.USER_SERVICE); if (userManager.isUserAGoat()) { Log.v(TAG, "The user IS a goat and subject to teleportations"); } else {//from ww w . j a v a2 s .c o m Log.v(TAG, "The user IS NOT a goat and subject to teleportations"); } Intent intent = getIntent(); // Get the default image path for the screenshot if present defaultImagePath = intent.getStringExtra(DEFAULT_IMAGE_PATH); // Get the configuration type isPush = intent.getBooleanExtra(IS_PUSH_STRING, true); // Get values related to a pull configuration selectedPullConfigurationIndex = intent.getLongExtra(SELECTED_PULL_CONFIGURATION_INDEX_STRING, -1); String jsonString = intent.getStringExtra(JSON_CONFIGURATION_STRING); // Initialization based on the type of configuration, i.e., if it is push or pull language = intent.getStringExtra(EXTRA_KEY_LANGUAGE); baseURL = intent.getStringExtra(EXTRA_KEY_BASE_URL); if (!isPush && selectedPullConfigurationIndex != -1 && jsonString != null) { // The feedback activity is started on behalf of a triggered pull configuration Log.v(TAG, "The feedback activity is started via a PULL configuration"); // Save the current configuration under FeedbackActivity.CONFIGURATION_DIR}/FeedbackActivity.JSON_CONFIGURATION_FILE_NAME Utils.saveStringContentToInternalStorage(getApplicationContext(), CONFIGURATION_DIR, JSON_CONFIGURATION_FILE_NAME, jsonString, MODE_PRIVATE); orchestratorConfigurationItem = new Gson().fromJson(jsonString, OrchestratorConfigurationItem.class); initModel(); initView(); } else { // The feedback activity is started on behalf of the user Log.v(TAG, "The feedback activity is started via a PUSH configuration"); // TODO: remove before release //initOfflineConfiguration(); // TODO: uncomment before release // Get the application id and language init(intent.getLongExtra(EXTRA_KEY_APPLICATION_ID, -1L), baseURL, language); } }
From source file:com.example.linhdq.test.documents.creation.NewDocumentActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (RESULT_OK == resultCode) { switch (requestCode) { case REQUEST_CODE_CROP_PHOTO: { long nativePix = data.getLongExtra(EXTRA_NATIVE_PIX, 0); startOcrActivity(nativePix, false); break; }/* w w w . j a va 2 s . c o m*/ case REQUEST_CODE_MAKE_PHOTO: mCameraResult = new CameraResult(requestCode, resultCode, data, ImageSource.CAMERA); break; case REQUEST_CODE_PICK_PHOTO: mCameraResult = new CameraResult(requestCode, resultCode, data, ImageSource.PICK); break; } } else if (CropImageActivity.RESULT_NEW_IMAGE == resultCode) { switch (mImageSource) { case PICK: startGallery(); break; case INTENT: break; case CAMERA: startCamera(); break; } } }
From source file:com.mobicage.rogerthat.plugins.messaging.FriendsThreadActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.message_thread); _1_DP_IN_PX = UIUtils.convertDipToPixels(this, 1); _4_DP_IN_PX = UIUtils.convertDipToPixels(this, 4); _20_DP_IN_PX = UIUtils.convertDipToPixels(this, 20); _42_DP_IN_PX = UIUtils.convertDipToPixels(this, 42); mRenderedMessages = new HashSet<>(); final Intent intent = getIntent(); mParentMessageKey = intent.getStringExtra(PARENT_MESSAGE_KEY); mFlags = intent.getLongExtra(MESSAGE_FLAGS, 0); ListView listView = (ListView) findViewById(R.id.thread_messages); setListView(listView);/*from w w w .j a v a 2 s . com*/ mScroller = Scroller.getInstance(); listView.setDivider(null); listView.setVerticalScrollBarEnabled(false); mScroller.setListView(listView); final IntentFilter filter1 = new IntentFilter(); for (String action : getAllReceivingIntents()) { filter1.addAction(action); } registerReceiver(getDefaultBroadcastReceiver(), filter1); IntentFilter filter2 = new IntentFilter(MessagingPlugin.NEW_MESSAGE_QUEUED_TO_BACKLOG_INTENT); filter2.addAction(MessagingPlugin.THREAD_DELETED_INTENT); filter2.addAction(BrandingMgr.ATTACHMENT_AVAILABLE_INTENT); filter2.addAction(MessagingPlugin.THREAD_MODIFIED_INTENT); filter2.addAction(FriendsPlugin.FRIEND_INFO_RECEIVED_INTENT); filter2.addAction(SystemPlugin.ASSET_AVAILABLE_INTENT); registerReceiver(mReceiver, filter2); }
From source file:org.wheelmap.android.activity.POIDetailActivity.java
private void executeIntent(Intent intent) { if (intent == null) { return;//from ww w .ja v a2 s . c o m } // check if this intent is started via custom scheme link if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri uri = intent.getData(); if (uri == null) { Log.d(TAG, "uri has no data - cant extract wmID"); showErrorMessage(getString(R.string.error_noid_title), getString(R.string.error_noid_message)); return; } wmID = uri.getLastPathSegment(); try { Long.parseLong(wmID); } catch (NumberFormatException e) { Log.e(TAG, " wmID = " + wmID, e); finish(); return; } showDetailForWmId(wmID); return; } Long poiId = intent.getLongExtra(Extra.POI_ID, Extra.ID_UNKNOWN); showDetailFragment(poiId); setIntent(null); }
From source file:com.nachiket.titan.LibraryActivity.java
/** * Creates a context menu for an adapter row. * * @param menu The menu to create./*from www. j a va 2s . c om*/ * @param rowData Data for the adapter row. */ public void onCreateContextMenu(ContextMenu menu, Intent rowData) { if (rowData.getLongExtra(LibraryAdapter.DATA_ID, LibraryAdapter.INVALID_ID) == LibraryAdapter.HEADER_ID) { menu.setHeaderTitle(getString(R.string.all_songs)); menu.add(0, MENU_PLAY_ALL, 0, R.string.play_all).setIntent(rowData); menu.add(0, MENU_ENQUEUE_ALL, 0, R.string.enqueue_all).setIntent(rowData); menu.addSubMenu(0, MENU_ADD_TO_PLAYLIST, 0, R.string.add_to_playlist).getItem().setIntent(rowData); } else { int type = rowData.getIntExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_INVALID); boolean isAllAdapter = type <= MediaUtils.TYPE_SONG; menu.setHeaderTitle(rowData.getStringExtra(LibraryAdapter.DATA_TITLE)); menu.add(0, MENU_PLAY, 0, R.string.play).setIntent(rowData); if (isAllAdapter) menu.add(0, MENU_PLAY_ALL, 0, R.string.play_all).setIntent(rowData); menu.add(0, MENU_ENQUEUE, 0, R.string.enqueue).setIntent(rowData); if (isAllAdapter) menu.add(0, MENU_ENQUEUE_ALL, 0, R.string.enqueue_all).setIntent(rowData); if (type == MediaUtils.TYPE_PLAYLIST) { menu.add(0, MENU_RENAME_PLAYLIST, 0, R.string.rename).setIntent(rowData); menu.add(0, MENU_EXPAND, 0, R.string.edit).setIntent(rowData); } else if (rowData.getBooleanExtra(LibraryAdapter.DATA_EXPANDABLE, false)) { menu.add(0, MENU_EXPAND, 0, R.string.expand).setIntent(rowData); } if (type == MediaUtils.TYPE_ALBUM || type == MediaUtils.TYPE_SONG) menu.add(0, MENU_MORE_FROM_ARTIST, 0, R.string.more_from_artist).setIntent(rowData); if (type == MediaUtils.TYPE_SONG) menu.add(0, MENU_MORE_FROM_ALBUM, 0, R.string.more_from_album).setIntent(rowData); menu.addSubMenu(0, MENU_ADD_TO_PLAYLIST, 0, R.string.add_to_playlist).getItem().setIntent(rowData); menu.add(0, MENU_DELETE, 0, R.string.delete).setIntent(rowData); } }
From source file:ch.teamuit.android.soundplusplus.LibraryActivity.java
/** * Called by LibraryAdapters when a row has been clicked. * * @param rowData The data for the row that was clicked. *//*from w w w.j a v a2s . c o m*/ public void onItemClicked(Intent rowData) { int action = mDefaultAction; if (action == ACTION_LAST_USED) action = mLastAction; if (action == ACTION_EXPAND && rowData.getBooleanExtra(LibraryAdapter.DATA_EXPANDABLE, false)) { onItemExpanded(rowData); } else if (rowData.getLongExtra(LibraryAdapter.DATA_ID, LibraryAdapter.INVALID_ID) == mLastActedId) { openPlaybackActivity(); } else if (action != ACTION_DO_NOTHING) { if (action == ACTION_EXPAND) { // default to playing when trying to expand something that can't // be expanded action = ACTION_PLAY; } else if (action == ACTION_PLAY_OR_ENQUEUE) { action = (mState & PlaybackService.FLAG_PLAYING) == 0 ? ACTION_PLAY : ACTION_ENQUEUE; } pickSongs(rowData, action); } }
From source file:com.android.contacts.group.GroupMembersFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode != Activity.RESULT_OK || data == null || requestCode != RESULT_GROUP_ADD_MEMBER) { return;/*from ww w .j a v a 2 s .c o m*/ } long[] contactIds = data.getLongArrayExtra(UiIntentActions.TARGET_CONTACT_IDS_EXTRA_KEY); if (contactIds == null) { final long contactId = data.getLongExtra(UiIntentActions.TARGET_CONTACT_ID_EXTRA_KEY, -1); if (contactId > -1) { contactIds = new long[1]; contactIds[0] = contactId; } } new UpdateGroupMembersAsyncTask(UpdateGroupMembersAsyncTask.TYPE_ADD, getContext(), contactIds, mGroupMetaData.groupId, mGroupMetaData.accountName, mGroupMetaData.accountType, mGroupMetaData.dataSet).execute(); }
From source file:com.nachiket.titan.LibraryActivity.java
/** * Adds songs matching the data from the given intent to the song timelime. * * @param intent An intent created with/*from www . j a v a 2 s. c om*/ * {@link LibraryAdapter#createData(View)}. * @param action One of LibraryActivity.ACTION_* */ private void pickSongs(Intent intent, int action) { long id = intent.getLongExtra("id", LibraryAdapter.INVALID_ID); boolean all = false; int mode = action; if (action == ACTION_PLAY_ALL || action == ACTION_ENQUEUE_ALL) { int type = mCurrentAdapter.getMediaType(); boolean notPlayAllAdapter = type > MediaUtils.TYPE_SONG || id == LibraryAdapter.HEADER_ID; if (mode == ACTION_ENQUEUE_ALL && notPlayAllAdapter) { mode = ACTION_ENQUEUE; } else if (mode == ACTION_PLAY_ALL && notPlayAllAdapter) { mode = ACTION_PLAY; } else { all = true; } } QueryTask query = buildQueryFromIntent(intent, false, all); query.mode = modeForAction[mode]; PlaybackService.get(this).addSongs(query); mLastActedId = id; if (mDefaultAction == ACTION_LAST_USED && mLastAction != action) { mLastAction = action; updateHeaders(); } }
From source file:com.ultramegasoft.flavordex2.dialog.FileImportDialog.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case REQUEST_DUPLICATES: if (resultCode == Activity.RESULT_OK) { uncheckDuplicates();/*from w ww . j a v a2 s . c o m*/ } break; case REQUEST_SET_CATEGORY: final FragmentManager fm = getFragmentManager(); if (fm != null) { CatListDialog.closeDialog(fm); } if (resultCode == Activity.RESULT_OK && data != null && mData != null) { final long catId = data.getLongExtra(CatListDialog.EXTRA_CAT_ID, 0); for (EntryHolder entry : mData.entries) { entry.catId = catId; } mData.hasCategory = true; validateData(); } else { dismiss(); } } super.onActivityResult(requestCode, resultCode, data); }
From source file:com.flipzu.flipzu.Recorder.java
private void updateState(Intent intent) { String state = intent.getStringExtra("state"); dState = intent.getIntExtra("err_code", 0); mStartTime = intent.getLongExtra("start_time", 0); mBcastId = intent.getIntExtra("bcast_id", 0); debug.logV(TAG, "updateState() with state " + state + " and error " + dState.toString()); if (state.equals(FlipzuRecorderService.STATUS_RECORDING)) { debug.logV(TAG, "updateState to RECORDING"); mState = recorderState.RECORDING; }// w ww. ja va2 s .co m if (state.equals(FlipzuRecorderService.STATUS_STOPPED)) { debug.logV(TAG, "updateState to STOPPED"); mState = recorderState.STOPPED; } if (state.equals(FlipzuRecorderService.STATUS_CONNECTING)) { debug.logV(TAG, "updateState to CONNECTING"); mState = recorderState.CONNECTING; } /* refresh UI */ refreshScreen(); }