@Override public void parseJson(int code, JSONObject respanse, String tag, int pos, Object data) throws JSONException { if (tag.equals(TAG_SAVE_CONTENT)) { showProgressBar(false); if (code == 0) { showProgressBar(true, "正在保存"); setResult(RESULT_OK); String url = mParam.getHtttpFileView(); getNetwork(url, TAG_HTTP_FILE_VIEW); } else { showErrorMsg(code, respanse); } } else if (tag.equals(TAG_HTTP_FILE_VIEW)) { showProgressBar(false); if (code == 0) { JSONObject json = respanse.optJSONObject("data").optJSONObject("file"); AttachmentFileObject fileObject = new AttachmentFileObject(json); FileSaveHelp help = new FileSaveHelp(this); mParam.setFileObject(fileObject); File localFile = mParam.getLocalFile(help.getFileDownloadPath()); writeFile(localFile, editText.getText().toString()); fileObject.isDownload = true; Intent intent = new Intent(); intent.putExtra(AttachmentFileObject.RESULT, fileObject); intent.putExtra( AttachmentsActivity.FileActions.ACTION_NAME, AttachmentsActivity.FileActions.ACTION_EDIT); setResult(RESULT_OK, intent); finish(); } else { showErrorMsg(code, respanse); } } }
@AfterViews final void initTxtEditActivity() { getSupportActionBar().setTitle(mParam.getFileObject().getName()); mFileSaveHelp = new FileSaveHelp(this); File file = mParam.getLocalFile(mFileSaveHelp.getFileDownloadPath()); if (file != null && file.exists()) { String content = readPhoneNumber(file); editText.setText(content); } else { showButtomToast("文件未保存到本地"); finish(); } }