@Override protected void onPreExecute() { mCommonActivityTitle.showTitleLeftLoading(); if (!CommUtil.JudgeNetWorkStatus(ApplicationVariable.INSTANCE.applicationContext)) { GlobalToast.showToast(R.string.net_warn_no_network, 0); hasNet = false; // 仅提示,会加载缓存 } super.onPreExecute(); }
@Override protected void onPreExecute() { if (!CommUtil.JudgeNetWorkStatus(ApplicationVariable.INSTANCE.applicationContext)) { GlobalToast.showToast(R.string.net_warn_no_network, 0); cancel(true); // 失败 存入草稿 savePostDraft(); return; } mCommonActivityTitle.showTitleLeftLoading(); }
@Override protected void onPostExecute(PostDetailEntity result) { // 防止下载中点击返回崩溃 if (isFinish) return; mCommonActivityTitle.hideTitleLeftLoading(); if (hasNet && (result == null || result.postDetail == null)) { // 无网络下只提示没有网络,不提示获取失败 fix BUG #56014 // 【广场消息】无网络情况下,点击消息页面的任意一则消息,页面会跳转至帖子详情页面,并提示“获取帖子详情失败”,建议修改提示语 GlobalToast.showToast("获取帖子详情失败", 0); return; } if (result == null) return; bindData(result, mAfterFollow); }
@Override public void onClick(View v) { int id = v.getId(); if (id == R.id.rl_post_detail_love) { // TODO点赞 if (!NetUtil.hasNet()) { return; } if (mPraise_done != -1) { if (PraiseTask.mPraiseMap.get(mMainId) == null) { PraiseTask.mPraiseMap.put(mMainId, 1); new PraiseTask(new PraiseEventBean(mMainId, mPraise_num, mPraise_done)).execute(); } else { // 操作请求中,不要频繁点击 GlobalToast.showToast(R.string.common_donnot_touchme, 0); } } } else if (id == R.id.rl_post_detail_comment) { // 评论 // TODO弹出输入框 switchMode(); } else if (id == R.id.rl_input) { switchMode(); } else if (id == R.id.btn_send) { mInputBar.cancelRecord(); // 发表跟帖 Boolean enable = (Boolean) v.getTag(); if (mEditContent == null || enable == null || !enable) { return; } else { String temp = mEditContent.getText().toString().replaceAll(" ", ""); temp = temp.replaceAll("\n", ""); if (temp.length() == 0) { GlobalToast.showToast(R.string.post_content_empty_hit, 0); return; } } new FollowTask(mMainId, mInputBar).execute(); // new SumitTopicTask(mMainPostId, mInputBar).execute(); // BUG #56254 建议:【47984】【论坛】发布跟帖-网络不可用时,提示失败信息,再点击评论按钮,之前输入的评论还保存 // clearEditText(mEditContent); switchMode(); } else if (id == R.id.et_input) { // 点击输入框 // fix BUG #57668 建议:【论坛】发表跟帖时,输入框操作会跳动影响使用体验,建议优化 if (mInputBar.getCurrentSelectedTabId() != CommonInputBar.TAB_KEYBOARD) { // mInputBar.setTabSelect(CommonInputBar.TAB_KEYBOARD); mInputBar.showCommonInputBar(); } // mInputBar.showCommonInputBar(); } else if (id == R.id.btn_more) { // 点击查看更多跟帖 // GlobalToast.showToast("全部跟帖", 0); UIHelper.showAllFollowActivity(mContext, mMainId, mFollow_num); } else if (id == R.id.rl_input_textonly) { switchTestOnlyMode(); } else if (id == R.id.btn_send_text) { String text = mEditText.getText().toString(); Boolean enable = (Boolean) v.getTag(); if (text == null || enable == null || !enable) { return; } if (!TextUtils.isEmpty(text)) { if (replyType == 1) { // 评论跟帖 ReplyFollowInfo info = new ReplyFollowInfo(mReplyFollowInfo.tid, text); new MyReplyFollowTask(info).execute(); } else if (replyType == 2) { // 回复评论 ReplyComment replyComment = new ReplyComment(mReplyInfo.oid, mReplyInfo.rid, mReplyInfo.user.uid, text); new MyReplyCommentTask(replyComment).execute(); } clearEditText(mEditText); } switchTestOnlyMode(); } else if (id == R.id.et_input_text) { if (mEditText.isFocused()) { // // ToastUtils.hideSoftInput(mContext, mEditText); // mListView.requestFocus(); } else { InputMethodUtils.showSoftInputMethod(mContext, mEditText); mEditText.requestFocus(); } } }