private void sendNow(final String postT, final String postC, final File upload) { UI.hideInputMethod(); findViewById(R.id.subforum_submit).setEnabled(false); final Request request = new Request(Request.SubmitConsu); request.setParam("subject", postT); request.setParam("content", postC); request.setParam( "parent_id", mPID + ""); // TODO to indicate this is a new subject a just a sub response to a parent // subject if (upload != null) { request.setSoTimeout(30000); request.setFile("plant_photo", upload); } final ProgressDialog pd = new ProgressDialog(this); pd.setMessage("正在发表提问"); pd.setCanceledOnTouchOutside(false); pd.setOnCancelListener( new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { request.shutdown(); findViewById(R.id.subforum_submit).setEnabled(true); } }); pd.show(); request.asyncRequest( new Request.ResponseListener() { @Override public void onResp(int id, Resp resp, Object... obj) { if (resp != null) { if (resp.success) { UI.toast("评论成功"); isUpdated = true; // finish(); mChildCount++; adapter.notifyDataSetChanged(); onLoadMore(true); if (mLoadingView.getVisibility() != View.VISIBLE) { mLoadingView.clearAnimation(); AnimUtils.DropIn.startAnimation(mLoadingView, 300); } postContent.setText(""); } else { UI.toast("回帖失败"); } pd.dismiss(); } findViewById(R.id.subforum_submit).setEnabled(true); } @Override public void onErr(int id, String err, int httpCode, Object... obj) { pd.dismiss(); UI.toast(err); findViewById(R.id.subforum_submit).setEnabled(true); } }, 0); }