涉及到用户操作的加上登录验证, 把评论点赞抽离成工具方法

This commit is contained in:
kehaoyuan
2017-06-28 18:06:36 +08:00
parent 957305d6f5
commit f960b07ee1
17 changed files with 546 additions and 499 deletions

View File

@ -27,6 +27,7 @@ import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.base.AppController;
import com.gh.base.BaseActivity;
import com.gh.common.constant.Config;
import com.gh.common.util.CheckLoginUtils;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.ImageUtils;
import com.gh.common.util.PostCommentUtils;
@ -330,25 +331,29 @@ public class MessageDetailActivity extends BaseActivity implements OnCommentCall
//软键盘控制
private void setSoftInput(boolean isShow) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (isShow) {
imm.showSoftInputFromInputMethod(mMessageDetailEt.getWindowToken(), 0);
imm.toggleSoftInputFromWindow(mMessageDetailEt.getWindowToken(), 0, InputMethodManager.HIDE_NOT_ALWAYS);
mMessageDetailCommentHintRl.setVisibility(View.GONE);
mMessageDetailLine.setVisibility(View.GONE);
mMessageDetailCommentRl.setVisibility(View.VISIBLE);
mMessageDetailUserRl.setVisibility(View.VISIBLE);
mMessageDetailEt.setFocusable(true);
mMessageDetailEt.setFocusableInTouchMode(true);
mMessageDetailEt.requestFocus();
mColseCommentV.setVisibility(View.VISIBLE);
if (mCommentEntity != null && mCommentEntity.getUser() != null) {
mMessageDetailEt.setHint("回复" + mCommentEntity.getUser().getName() + "");
} else {
mMessageDetailEt.setHint("优质评论会被优先展示");
}
CheckLoginUtils.checkLogin(this, new CheckLoginUtils.OnLoggenInListener() {
@Override
public void onLoggedIn() {
imm.showSoftInputFromInputMethod(mMessageDetailEt.getWindowToken(), 0);
imm.toggleSoftInputFromWindow(mMessageDetailEt.getWindowToken(), 0, InputMethodManager.HIDE_NOT_ALWAYS);
mMessageDetailCommentHintRl.setVisibility(View.GONE);
mMessageDetailLine.setVisibility(View.GONE);
mMessageDetailCommentRl.setVisibility(View.VISIBLE);
mMessageDetailUserRl.setVisibility(View.VISIBLE);
mMessageDetailEt.setFocusable(true);
mMessageDetailEt.setFocusableInTouchMode(true);
mMessageDetailEt.requestFocus();
mColseCommentV.setVisibility(View.VISIBLE);
if (mCommentEntity != null && mCommentEntity.getUser() != null) {
mMessageDetailEt.setHint("回复" + mCommentEntity.getUser().getName() + "");
} else {
mMessageDetailEt.setHint("优质评论会被优先展示");
}
}
});
} else {
imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);
mMessageDetailCommentHintRl.setVisibility(View.VISIBLE);