|
@@ -3,13 +3,18 @@ package com.sheep.gamegroup.view.fragment;
|
|
|
import android.content.DialogInterface;
|
|
import android.content.DialogInterface;
|
|
|
import android.support.annotation.NonNull;
|
|
import android.support.annotation.NonNull;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
|
|
+import android.text.TextUtils;
|
|
|
|
|
+import android.view.KeyEvent;
|
|
|
import android.view.LayoutInflater;
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
import android.widget.EditText;
|
|
import android.widget.EditText;
|
|
|
|
|
+import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
|
|
+import com.lqr.emoji.EmotionKeyboard;
|
|
|
|
|
+import com.lqr.emoji.EmotionLayout;
|
|
|
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
|
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
|
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
|
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
|
@@ -20,6 +25,7 @@ import com.sheep.gamegroup.model.entity.UserCommentReply;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.util.ApiJSONUtil;
|
|
import com.sheep.gamegroup.util.ApiJSONUtil;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
|
|
+import com.sheep.gamegroup.util.KeyEventUtil;
|
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
|
import com.sheep.gamegroup.util.RefreshUtil;
|
|
import com.sheep.gamegroup.util.RefreshUtil;
|
|
|
import com.sheep.gamegroup.util.TestUtil;
|
|
import com.sheep.gamegroup.util.TestUtil;
|
|
@@ -49,20 +55,35 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public int getLayoutId() {
|
|
public int getLayoutId() {
|
|
|
- return R.layout.net_empty_smart_refresh_rv;
|
|
|
|
|
|
|
+ return R.layout.net_empty_smart_refresh_rv_exp;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@BindView(R.id.refresh)
|
|
@BindView(R.id.refresh)
|
|
|
SmartRefreshLayout refresh;
|
|
SmartRefreshLayout refresh;
|
|
|
@BindView(R.id.bottom)
|
|
@BindView(R.id.bottom)
|
|
|
RelativeLayout bottom;
|
|
RelativeLayout bottom;
|
|
|
|
|
+ @BindView(R.id.rlContent)
|
|
|
|
|
+ RelativeLayout rlContent;
|
|
|
|
|
+ @BindView(R.id.elEmotion)
|
|
|
|
|
+ EmotionLayout elEmotion;
|
|
|
//输入框
|
|
//输入框
|
|
|
private EditText input_comment_input;
|
|
private EditText input_comment_input;
|
|
|
|
|
+ private ImageView input_comment_exp;
|
|
|
|
|
+
|
|
|
|
|
+ //表情键盘协调工具
|
|
|
|
|
+ private EmotionKeyboard mEmotionKeyboard;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void initView() {
|
|
public void initView() {
|
|
|
TitleBarUtils.getInstance().setTitle(mView, "评论详情")
|
|
TitleBarUtils.getInstance().setTitle(mView, "评论详情")
|
|
|
- .setTitleFinish(mView, activity);
|
|
|
|
|
|
|
+ .setTitleFinish(mView, new View.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(View view) {
|
|
|
|
|
+ if (!onBackPressed()) {
|
|
|
|
|
+ KeyEventUtil.sendKeyDownUp(KeyEvent.KEYCODE_BACK);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
smartRefreshLayout = refresh;
|
|
smartRefreshLayout = refresh;
|
|
|
refresh.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
|
refresh.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
|
|
@Override
|
|
@Override
|
|
@@ -83,26 +104,33 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> {
|
|
|
//尾部,在无数据时显示
|
|
//尾部,在无数据时显示
|
|
|
footerView = LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.footer_user_comment_detail, null);
|
|
footerView = LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.footer_user_comment_detail, null);
|
|
|
//底部可发表评论
|
|
//底部可发表评论
|
|
|
- LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.include_input_comment, bottom);
|
|
|
|
|
|
|
+ LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.include_input_comment_exp, bottom);
|
|
|
input_comment_input = bottom.findViewById(R.id.input_comment_input);
|
|
input_comment_input = bottom.findViewById(R.id.input_comment_input);
|
|
|
|
|
+ input_comment_exp = bottom.findViewById(R.id.input_comment_exp);
|
|
|
bottom.findViewById(R.id.input_comment_commit).setOnClickListener(new View.OnClickListener() {
|
|
bottom.findViewById(R.id.input_comment_commit).setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
public void onClick(View view) {
|
|
|
String content = input_comment_input.getText().toString();
|
|
String content = input_comment_input.getText().toString();
|
|
|
- commitContent(content);
|
|
|
|
|
|
|
+ String changeContent = EmotionLayout.changeContent(content);
|
|
|
|
|
+ commitContent(changeContent, !TextUtils.equals(content, changeContent));
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+ //初始化 表情键盘协调工具
|
|
|
|
|
+ initEmotionKeyboard();
|
|
|
|
|
+ initSticker();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//用户评论一个用户对游戏的评论
|
|
//用户评论一个用户对游戏的评论
|
|
|
- private void commitContent(String content) {
|
|
|
|
|
|
|
+ private void commitContent(String content, boolean expression) {
|
|
|
if (TestUtil.isDev()) G.showToast("评论内容:" + content);
|
|
if (TestUtil.isDev()) G.showToast("评论内容:" + content);
|
|
|
if (content.isEmpty()) {
|
|
if (content.isEmpty()) {
|
|
|
G.showToast("评论内容不能为空");
|
|
G.showToast("评论内容不能为空");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
// 发表评论
|
|
// 发表评论
|
|
|
- ApiJSONUtil.postGameUserUserComment(user_comment_id, false, content)
|
|
|
|
|
|
|
+ ApiJSONUtil.postGameUserUserComment(user_comment_id, expression, content)
|
|
|
.subscribeOn(Schedulers.io())
|
|
.subscribeOn(Schedulers.io())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
.subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
.subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
@@ -131,6 +159,7 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> {
|
|
|
private View user_comment_detail_line1;
|
|
private View user_comment_detail_line1;
|
|
|
private View user_comment_detail_line2;
|
|
private View user_comment_detail_line2;
|
|
|
private TextView total_count_tv;
|
|
private TextView total_count_tv;
|
|
|
|
|
+
|
|
|
//初始化headerView
|
|
//初始化headerView
|
|
|
private void initHeaderView() {
|
|
private void initHeaderView() {
|
|
|
headerViewHelper = new UserCommentHelper(R.layout.header_user_comment_detail);
|
|
headerViewHelper = new UserCommentHelper(R.layout.header_user_comment_detail);
|
|
@@ -142,7 +171,7 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> {
|
|
|
user_comment_detail_game_ll.setVisibility(View.GONE);
|
|
user_comment_detail_game_ll.setVisibility(View.GONE);
|
|
|
user_comment_detail_line1.setVisibility(View.GONE);
|
|
user_comment_detail_line1.setVisibility(View.GONE);
|
|
|
user_comment_detail_line2.setVisibility(View.GONE);
|
|
user_comment_detail_line2.setVisibility(View.GONE);
|
|
|
- if(total_count_tv != null){
|
|
|
|
|
|
|
+ if (total_count_tv != null) {
|
|
|
ViewUtil.setText(total_count_tv, getString(R.string.total_x_comment, ViewUtil.BLOCK));
|
|
ViewUtil.setText(total_count_tv, getString(R.string.total_x_comment, ViewUtil.BLOCK));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -188,7 +217,7 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> {
|
|
|
if (page == 1 && userCommentDetail != null) {//第一页才有下面的数据
|
|
if (page == 1 && userCommentDetail != null) {//第一页才有下面的数据
|
|
|
adapter.setUserComment(userCommentDetail.getUser_comment());
|
|
adapter.setUserComment(userCommentDetail.getUser_comment());
|
|
|
headerViewHelper.loadHeaderViewData(userCommentDetail.getUser_comment());
|
|
headerViewHelper.loadHeaderViewData(userCommentDetail.getUser_comment());
|
|
|
- if(!userCommentDetail.getUser_comment().isArticleUserComment()){
|
|
|
|
|
|
|
+ if (!userCommentDetail.getUser_comment().isArticleUserComment()) {
|
|
|
headerViewHelper.getUser_comment_detail_user_publish_score().setVisibility(View.VISIBLE);
|
|
headerViewHelper.getUser_comment_detail_user_publish_score().setVisibility(View.VISIBLE);
|
|
|
user_comment_detail_game_ll.setVisibility(View.VISIBLE);
|
|
user_comment_detail_game_ll.setVisibility(View.VISIBLE);
|
|
|
user_comment_detail_line1.setVisibility(View.VISIBLE);
|
|
user_comment_detail_line1.setVisibility(View.VISIBLE);
|
|
@@ -229,4 +258,25 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private void initSticker() {
|
|
|
|
|
+ elEmotion.attachEditText(input_comment_input);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //初始化 表情键盘协调工具
|
|
|
|
|
+ private void initEmotionKeyboard() {
|
|
|
|
|
+ mEmotionKeyboard = EmotionKeyboard.with(activity);
|
|
|
|
|
+ mEmotionKeyboard.bindToContent(rlContent);
|
|
|
|
|
+ mEmotionKeyboard.bindToEmotionButton(input_comment_exp);
|
|
|
|
|
+ mEmotionKeyboard.bindToEditText(input_comment_input);
|
|
|
|
|
+ mEmotionKeyboard.setEmotionLayout(elEmotion);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //返回处理
|
|
|
|
|
+ public boolean onBackPressed() {
|
|
|
|
|
+ if (mEmotionKeyboard != null) {
|
|
|
|
|
+ return mEmotionKeyboard.interceptBackPress(true);
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|