Explorar el Código

评论详情中的回复也要显示表情

zengjiebin hace 7 años
padre
commit
09a2e0423e

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UserCommentReply.java

@@ -132,4 +132,14 @@ public class UserCommentReply {
         }
         return showAll;
     }
+
+    private ShowAll replyShowAll;
+    public ShowAll getReplyShowAll() {
+        if(replyShowAll == null) {
+            boolean hasExp = EmotionLayout.hasExp(reply);
+            replyShowAll = new ShowAll(hasExp ? EmotionLayout.changeContent(reply) : reply);
+            replyShowAll.setHasExp(hasExp);
+        }
+        return replyShowAll;
+    }
 }

+ 6 - 1
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpUserCommentReply.java

@@ -7,7 +7,9 @@ import android.widget.TextView;
 
 import com.chad.library.adapter.base.BaseQuickAdapter;
 import com.chad.library.adapter.base.BaseViewHolder;
+import com.lqr.emoji.EmotionLayout;
 import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.ShowAll;
 import com.sheep.gamegroup.model.entity.UserComment;
 import com.sheep.gamegroup.model.entity.UserCommentReply;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
@@ -77,7 +79,10 @@ public class AdpUserCommentReply extends BaseQuickAdapter<UserCommentReply, Base
         ViewUtil.setVisibility(game_app_comment_num1, isMe && !replyUserIsCommentUser && TextUtils.isEmpty(item.getReply()));//自己在自己的评论详情中,别人的评论下才显示回复图标,但是如果已经回复了,就不显示
         ViewUtil.setVisibility(game_app_comment_line_bottom, !TextUtils.isEmpty(item.getReply()));
         ViewUtil.setVisibility(user_comment_reply_content, !TextUtils.isEmpty(item.getReply()));
-        ViewUtil.setText(user_comment_reply_content, item.getReply());
+        if(item.getReplyShowAll().isHasExp())
+            ViewUtil.setH5ImgText(user_comment_reply_content, item.getReplyShowAll().getContent(), G.WIDTH - G.getRealPix(50));
+        else
+            ViewUtil.setText(user_comment_reply_content, item.getReply());
         TextViewUtil.initIntroView(helper.itemView, item.getShowAll());
         game_app_comment_num1.setOnClickListener(new View.OnClickListener() {
             @Override

+ 3 - 0
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtUserCommentDetail.java

@@ -140,6 +140,9 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> im
         }
         // 发表评论
         Observable<BaseMessage> observable = userCommentReply == null ? ApiJSONUtil.postGameUserUserComment(user_comment_id, content) : ApiJSONUtil.postGameUserReplyComment(userCommentReply.getId(), content);
+        if(userCommentReply != null){//只能回复一次,所以需要让回复输入框上面的回复xx消失
+            call(userCommentReply);
+        }
         observable.subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {