@OnActivityResult(FILE_DELETE_CODE) void onFileResult(int resultCode, Intent data) { Log.d("onFileResult", resultCode + ""); if (resultCode == Activity.RESULT_OK) { AttachmentFileObject deletedFileObject = (AttachmentFileObject) data.getSerializableExtra("mAttachmentFileObject"); Log.d("onFileResult", resultCode + " " + deletedFileObject.getName()); for (AttachmentFileObject file : mData) { if (file.file_id.equals(deletedFileObject.file_id)) { mData.remove(file); mAdapter.notifyDataSetChanged(); break; } } setResult(Activity.RESULT_OK); } }
@OnActivityResult(FILE_MOVE_CODE) void onFileMoveResult(int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { AttachmentFolderObject selectedFolder = (AttachmentFolderObject) data.getSerializableExtra("mAttachmentFolderObject"); String param = ""; if (selectedFolder.file_id.equals(mAttachmentFolderObject.file_id)) { return; } int i = 0; for (AttachmentFileObject file : selectFile) { if (i > 0) { param += "&"; } param += "fileId=" + file.file_id; i++; } putNetwork(String.format(HOST_FILE_MOVETO, mProjectObjectId, selectedFolder.file_id, param), null, HOST_FILE_MOVETO); } }
@OnActivityResult(ListModify.RESULT_EDIT_LIST) void onResultEditList(int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { taskListParentUpdate(); String globarKey = data.getStringExtra(TaskAddActivity.RESULT_GLOBARKEY); TaskObject.Members modifyMember = null; for (int i = 0; i < mMembersAllAll.size(); ++i) { if (mMembersAllAll.get(i).user.global_key.equals(globarKey)) { modifyMember = mMembersAllAll.get(i); break; } } if (modifyMember != null) { if (!mMembersAll.contains(modifyMember)) { mMembersAll.add(modifyMember); adapter.notifyDataSetChanged(); tabs.setViewPager(pager); } } } }
@OnActivityResult(RESULT_USER_DETAIL) protected final void resultUserDetail(int result, Intent data) { if (result == RESULT_OK) { Object object = data.getSerializableExtra("data"); if (object instanceof UserObject) { UserObject user = (UserObject) object; for (int i = 0; i < mData.size(); ++i) { if (user.global_key.equals(mData.get(i).global_key)) { mData.add(i, user); mData.remove(i + 1); baseAdapter.notifyDataSetChanged(); return; } } } } }
@OnActivityResult(REQUEST_CODE_SELECT_DIRECTORY_TO_EXPORT) void onActivityResultSelectDirectoryToExport(int resultCode, Intent data) { if (resultCode != RESULT_OK) { return; } String path = data.getExtras().getString(DirectorySelectorActivity.RESULT_INTENT_PATH); String defaultPath = String.format("%s/%s-%s.json", path, getResources().getString(R.string.app_name), DateTimeUtils.getInstance().getCurrentDateTimeString()); activityHelper .buildInputDialog(defaultPath, new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog materialDialog) { TextView textView = (TextView) materialDialog.findViewById(android.R.id.text1); String outputPath = textView.getText().toString(); exportCardsTo(outputPath); } }) .title(R.string.action_export) .show(); }
@Background @OnActivityResult(FilePickerHelper.ACTIVITY_FILEPICKER) public void onFilePicked(int resultCode, Intent data) { // We should have received an Intent with a local torrent's Uri as data from the file picker if (data != null && data.getData() != null && !data.getData().toString().equals("")) { Uri dataUri = data.getData(); // Get torrent title String title = NavigationHelper.extractNameFromUri(dataUri); // Adding a torrent from the via a content:// scheme (access through content provider stream) if (dataUri.getScheme().equals(ContentResolver.SCHEME_CONTENT)) { addTorrentFromDownloads(dataUri, title); return; } // Adding a .torrent file directly via the file:// scheme (we can access it directly) if (dataUri.getScheme().equals("file")) { addTorrentByFile(data.getDataString(), title); } } }
@OnActivityResult(BarcodeHelper.ACTIVITY_BARCODE_QRSETTINGS) public void onQrCodeScanned(@SuppressWarnings("UnusedParameters") int resultCode, Intent data) { // We should have received Intent extras with the QR-decoded data representing Transdroid settings if (data == null || !data.hasExtra("SCAN_RESULT")) return; // Cancelled scan; ignore SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SystemSettingsActivity.this); String contents = data.getStringExtra("SCAN_RESULT"); String formatName = data.getStringExtra("SCAN_RESULT_FORMAT"); if (formatName != null && formatName.equals("QR_CODE") && !TextUtils.isEmpty(contents)) { try { settingsPersistence.importSettingsAsString(prefs, contents); SnackbarManager.show(Snackbar.with(SystemSettingsActivity.this).text(R.string.pref_import_success)); } catch (JSONException e) { SnackbarManager .show(Snackbar.with(SystemSettingsActivity.this).text(R.string.error_file_not_found).colorResource(R.color.red)); } } }
@OnActivityResult(REQUEST_CODE) public void onResult(int resultCode, Intent intent) { if (resultCode == RESULT_OK) { uri = intent.getData(); displayFromUri(uri); } }
@OnActivityResult(RESULT_USER_DETAIL) final void resultUserDetail(int result, Intent data) { if (result == Activity.RESULT_OK) { UserObject userObject = (UserObject) data.getSerializableExtra("data"); for (int i = 0; i < mUserList.size(); ++i) { if (mUserList.get(i).id == userObject.id) { mUserList.remove(i); mUserList.add(i, userObject); mAdapter.notifyDataSetChanged(); return; } } } }
@OnActivityResult(RESULT_REQUEST_SELECT_USER) void onResultPickMember(int result, Intent intent) { if (result == RESULT_OK) { mUser = (TaskObject.Members) intent.getSerializableExtra("members"); updatePickMemberDisplay(); } }
@OnActivityResult(RESULT_PROJECT_SEARCH_PICK) final void resultPickSearch(int result, Intent intent) { if (result == Activity.RESULT_OK) { // ProjectObject projectObject = (ProjectObject) intent.getSerializableExtra("data"); // Intent intent1 = new Intent(); // intent1.putExtra("data", proj); getActivity().setResult(Activity.RESULT_OK, intent); getActivity().finish(); } }
@OnActivityResult(RESULT_LABEL) protected void onResultLabel(int code, @OnActivityResult.Extra ArrayList<TopicLabelObject> labels) { if (code == RESULT_OK) { modifyData.labels = labels; editFragment.updateLabels(modifyData.labels); previewFragment.updateLabels(modifyData.labels); labelsHasChanged = true; saveLabelsIfCancel(); } }
@OnActivityResult(RESULT_PICK_COLOR) void onResultPickColor(int result, @OnActivityResult.Extra int resultData) { if (result == RESULT_OK) { generateColor = resultData; updateColorPreview(); } }
@OnActivityResult(RESULT_MODIFY) void onResultModify(int result, @OnActivityResult.Extra TopicLabelObject resultData) { if (result == RESULT_OK) { if (allLabels.containsKey(currentLabelId)) { TopicLabelObject topicLabelObject = allLabels.get(currentLabelId); topicLabelObject.name = resultData.name; topicLabelObject.color = resultData.color; } updateList(); } unlockViews(); }
@OnActivityResult(RESULT_PICK_COLOR) void onResultPickColor(int result, @OnActivityResult.Extra int resultData) { if (result == RESULT_OK) { labelObject.color = resultData; updateColorPreview(); } }
@OnActivityResult(ProjectAttachmentFragment.RESULT_REQUEST_FILES) void onFileResult(int resultCode, Intent data) { for (WeakReference<Fragment> item : mFragments) { Fragment f = item.get(); if (f instanceof ProjectAttachmentFragment_) { ((ProjectAttachmentFragment_) f).onFileResult(resultCode, data); } } }
@OnActivityResult(RESULT_SHARE_LINK) void onResultShareLink(int result, Intent intent) { if (result == RESULT_OK) { setResult(result, intent); mAttachmentFileObject = (AttachmentFileObject) intent.getSerializableExtra("data"); } }
@OnActivityResult(FILE_SELECT_CODE) void onResult(int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { Uri uri = data.getData(); String path = FileUtil.getPath(this, uri); File selectedFile = new File(path); uploadFilePrepare(selectedFile); } }
@OnActivityResult(RESULT_SHARE_LINK) void onResultShareLink(int result, Intent intent) { if (result == RESULT_OK) { mAttachmentFileObject = (AttachmentFileObject) intent.getSerializableExtra("data"); setResult(result, intent); } }
@OnActivityResult(RESULT_MODIFY_TXT) protected void onResultModify(int result, Intent intent) { if (result == Activity.RESULT_OK) { setResult(result, intent); mAttachmentFileObject = (AttachmentFileObject) intent.getSerializableExtra(AttachmentFileObject.RESULT); updateLoadFile(); } }
@OnActivityResult(RESULT_RESUSE_REFRESOURCE) void resultRefResource(int resultCode, @OnActivityResult.Extra ArrayList<RefResourceObject> resultData) { if (resultCode == RESULT_OK) { refResourceList = resultData; updateRefResourceUI(); } }
@OnActivityResult(RESULT_REQUEST_AT) void onResultAt(int requestCode, Intent data) { if (requestCode == Activity.RESULT_OK) { String name = data.getStringExtra("name"); EnterLayout.insertText(edit, name); } }
@OnActivityResult(RESULT_COMMENT) void onResultCreateComment(int result, Intent data) { if (result == RESULT_OK) { String s = data.getStringExtra("data"); try { JSONObject commentItem = new JSONObject(s); mCommentsData.optJSONArray("data").put(commentItem); updateWebViewDisplay(); showButtomToast("添加评论成功"); } catch (Exception e) { Global.errorLog(e); } } }
@OnActivityResult(RESULT_FILE_LIST) void onResultFileList(int result, Intent intent) { String title = intent.getStringExtra(LocalFileListActivity.RESULT_INTENT_TITLE); ArrayList<File> files = (ArrayList<File>) intent.getSerializableExtra(LocalFileListActivity.RESULT_INTENT_FILES); if (files.isEmpty()) { data.remove(title); } else { data.put(title, files); } setStrings = createListData(); adapter.notifyDataSetChanged(); }
@OnActivityResult(RESULT_COMMENT) void onResultComment(int result, Intent data) { if (result == RESULT_OK && data != null) { BaseComment comment = (BaseComment) data.getSerializableExtra("data"); mData.add(comment); adapter.notifyDataSetChanged(); } }
@OnActivityResult(RESULT_EDIT) void onResultEdit(int resultCode, @OnActivityResult.Extra GitFileBlobObject resultData) { if (resultCode == RESULT_OK) { mFile = resultData; bindUIByData(); } }
@OnActivityResult(RESULT_REQUEST_FILES) public void onFileResult(int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { initSetting(); //showDialogLoading(); setRefreshing(true); getNetwork(HOST_FILECOUNT, HOST_FILECOUNT); } }
@OnActivityResult(RESULT_AT) void onResultAt(int requestCode, Intent data) { if (requestCode == Activity.RESULT_OK) { String name = data.getStringExtra("name"); mEnterComment.getEnterLayout().insertText(name); mEnterComment.getEnterLayout().popKeyboard(); } }
@OnActivityResult(RESULT_EDIT) void onResultEdit() { // 分支情况太多,如编辑状态下可进入标签管理删掉目前用的标签, // 回到编辑后又重复进入修改名字或者继续添加删除,最后还可以不保存返回 // 除非一直把全局labels的所有状态通过intents传递,否则原状态难以维持,这里只好直接重新刷新了, // 会慢一些但状态肯定是对的,可能影响回复列表页数 saveTopicWhenLoaded = true; onRefresh(); }
@OnActivityResult(RESULT_LABEL) void onResultLabel(int code, @OnActivityResult.Extra ArrayList<TopicLabelObject> labels) { if (code == RESULT_OK) { topicObject.labels = labels; updateLabels(topicObject.labels); mResultData.putExtra("topic", topicObject); } }
@OnActivityResult(ImageCommentLayout.RESULT_REQUEST_COMMENT_IMAGE) protected final void commentImage(int result, Intent data) { if (result == RESULT_OK) { mEnterComment.onActivityResult( ImageCommentLayout.RESULT_REQUEST_COMMENT_IMAGE, data); } }
@OnActivityResult(ImageCommentLayout.RESULT_REQUEST_COMMENT_IMAGE_DETAIL) protected final void commentImageDetail(int result, Intent data) { if (result == RESULT_OK) { mEnterComment.onActivityResult( ImageCommentLayout.RESULT_REQUEST_COMMENT_IMAGE_DETAIL, data); } }
@OnActivityResult(RESULT_MODIFY_WATCHER) void onResultModifyWatcher(int code, @OnActivityResult.Extra ArrayList<UserObject> resultData) { if (code == RESULT_OK) { watchers = resultData; watchHelp.setData(this.watchers); } }
@OnActivityResult(RESULT_LOCAL) void onResultLocal(int resultCode, Intent data) { if (resultCode == RESULT_OK) { local = (Local) data.getSerializableExtra("result"); mall_order_edit_city.setText(local.getLocalString()); } }
@OnActivityResult(RESULT_SELECT_USER) void onSelectUser(int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { UserObject user = (UserObject) data.getSerializableExtra(UsersListActivity.RESULT_EXTRA_USESR); if (user != null) { MessageListActivity_.intent(this).mUserObject(user).start(); } } }
@OnActivityResult(RESULT_PICK_COUNTRY) void onResultPickCountry(int resultCode, @OnActivityResult.Extra PhoneCountry resultData) { if (resultCode == Activity.RESULT_OK && resultData != null) { pickCountry = resultData; bindCountry(); } }
@OnActivityResult(EmailRegisterActivity.RESULT_REGISTER_EMAIL) void resultEmailRegister(int result) { if (result == RESULT_OK) { setResult(RESULT_OK); finish(); } }
@OnActivityResult(RESULT_SET_PASSWORD) void onResultSetPassword(int resultCode) { if (resultCode == RESULT_OK) { setResult(resultCode); finish(); } }