/** 向服务器发出上传新版本 */ private void requestServer(String title, int type, String keyword, String summary, int id) { ProgressDialogUtil.show(mContext); OkHttpUtils.post() .url(Constant.URL + "recontribute") .addParams("articleId", String.valueOf(id)) .addParams("title", title) .addParams("type", String.valueOf(type)) .addParams("keyword", keyword) .addParams("summary", summary) .addFile("articleFile", mFileName, mFile) .addParams("source", "android") .build() .execute( new StringCallback() { @Override public void onError(Request request, Exception e) { ProgressDialogUtil.dismiss(); Log.e(getTagName(), "onError:" + e.getMessage()); T.show(mContext, "网络访问错误"); } @Override public void onResponse(String response) { ProgressDialogUtil.dismiss(); Log.e(getTagName(), "onResponse:" + response); try { JSONObject serverInfo = new JSONObject(response); boolean isSuccess = serverInfo.getBoolean("isSuccess"); if (isSuccess) { T.show(mContext, "上传新版本成功!!!"); // 返回上传新版本信息 Intent returnIntent = new Intent(); returnIntent.putExtra("isContributeNewManuscript", isSuccess); ContributeManuscriptActivity.this.setResult(Activity.RESULT_OK, returnIntent); finish(); } } catch (JSONException e) { e.printStackTrace(); } } }); }