public void onSuccess(JSONObject jo) { customDismissDialog(); try { int status = jo.getInt(URL.STATUS); switch (status) { case 0: if (fragment.getCount() > 0) { dyid = jo.getJSONObject(URL.RESPONSE).getString("dyid"); uploadImg(0); } else { showCustomToast("发表成功"); setResult(RESULT_OK); isOk = false; finish(); } break; default: showFailInfo(jo); isOk = true; break; } } catch (Exception e) { e.printStackTrace(); } };
@OptionsItem(R.id.ok) public void ok() { if (!isOk) { return; } // String content = Util.FilterEmoji(edittxt.getText().toString().trim()); String content = edittxt.getText().toString().trim(); // content=EmojiFilter.filterEmoji(content); if (!Util.isStrNotNull(content) && fragment.getCount() == 0) { showCustomToast("请输入内容或添加图片"); return; } isOk = false; customShowDialog("正在定位"); location.startLocation(); }
public void uploadImg(int i) { LogUtil.d("================图片上传次数", i + ""); if (i == fragment.getCount()) { return; } LoginUser user = getHelper().getUser(); try { RequestParams ap = getAjaxParams(); ap.put("file", new File(fragment.getItem(i))); ap.put("userid", user.getId()); ap.put("dyid", dyid); ap.put("position", i + ""); ac.finalHttp.post(URL.PUBLISH_IMG, ap, new callBack(i)); } catch (FileNotFoundException e) { e.printStackTrace(); } }