From c9e8408804d4654cdba5ca6eb91c239780976be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=8E=89=E4=B9=85?= <1484288157@qq.com> Date: Mon, 24 Aug 2020 11:53:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=86=E9=A2=91=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E4=BD=9C=E8=80=85=E6=A0=87=E8=AE=B0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qa/comment/StairsCommentReplyAdapter.kt | 6 +++ .../qa/comment/StairsCommentViewHolder.kt | 18 ++++++--- .../main/res/layout/stairs_comment_item.xml | 37 +++++++++++++++++-- 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentReplyAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentReplyAdapter.kt index c51ddf224a..ebeab2d4c1 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentReplyAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentReplyAdapter.kt @@ -63,6 +63,12 @@ class StairsCommentReplyAdapter(context: Context, val mViewModel: NewCommentView holder.binding.sdvUserBadge.visibility = View.GONE holder.binding.commentUserName.textSize = 12f + + if (commentEntity.reply == 0) { + val params = holder.binding.commentUsernameAndTime.layoutParams as RelativeLayout.LayoutParams + params.bottomMargin = 0 + holder.binding.commentUsernameAndTime.layoutParams = params + } } } } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentViewHolder.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentViewHolder.kt index 0913154d49..fe2604bbef 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentViewHolder.kt @@ -57,11 +57,14 @@ class StairsCommentViewHolder(val binding: StairsCommentItemBinding, val isReply binding.commentAuthor.visibility = View.GONE } if (parentUser != null && !TextUtils.isEmpty(parentUser.name)) { - val name = "${entity.user.name} 回复 ${parentUser.name}" - binding.commentUserName.text = SpanBuilder(name).color((entity.user.name?.length - ?: 0) + 1, (entity.user.name?.length ?: 0) + 3, R.color.text_666666).build() + binding.commentUserName.text = entity.user.name + binding.replyTv.visibility = View.VISIBLE + binding.commentReplyUserName.visibility = View.VISIBLE + binding.commentReplyUserName.text = parentUser.name } else { binding.commentUserName.text = userInfo.name + binding.replyTv.visibility = View.GONE + binding.commentReplyUserName.visibility = View.GONE } if (userInfo.auth != null) { display(binding.commentUserBadge, userInfo.auth!!.icon) @@ -76,11 +79,14 @@ class StairsCommentViewHolder(val binding: StairsCommentItemBinding, val isReply binding.commentAuthor.visibility = View.GONE } if (parentUser != null && !TextUtils.isEmpty(parentUser.name)) { - val name = "${entity.user.name} 回复 ${parentUser.name}" - binding.commentUserName.text = SpanBuilder(name).color((entity.user.name?.length - ?: 0) + 1, (entity.user.name?.length ?: 0) + 3, R.color.text_666666).build() + binding.commentUserName.text = entity.user.name + binding.replyTv.visibility = View.VISIBLE + binding.commentReplyUserName.visibility = View.VISIBLE + binding.commentReplyUserName.text = parentUser.name } else { binding.commentUserName.text = entity.user.name + binding.replyTv.visibility = View.GONE + binding.commentReplyUserName.visibility = View.GONE } if (entity.user.auth != null) { display(binding.commentUserBadge, entity.user.auth!!.icon) diff --git a/app/src/main/res/layout/stairs_comment_item.xml b/app/src/main/res/layout/stairs_comment_item.xml index 47494700d7..24ca86e631 100644 --- a/app/src/main/res/layout/stairs_comment_item.xml +++ b/app/src/main/res/layout/stairs_comment_item.xml @@ -93,6 +93,36 @@ app:layout_constraintTop_toTopOf="@+id/comment_user_name" tools:visibility="visible" /> + + + +