From 144ee3ea8ce04bb0eb45c8e29023a113cdb052eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E7=8E=89=E4=B9=85?= <1484288157@qq.com>
Date: Wed, 2 Sep 2020 09:49:56 +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=BAUI?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../qa/comment/StairsCommentAdapter.kt | 2 +-
.../qa/comment/StairsCommentFragment.kt | 4 ++--
.../qa/comment/StairsCommentReplyAdapter.kt | 2 +-
.../qa/comment/StairsCommentViewHolder.kt | 17 +++++++-------
.../main/res/layout/stairs_comment_item.xml | 22 +++++++++++++------
5 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentAdapter.kt
index 853b149d11..e4a037a8bd 100644
--- a/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentAdapter.kt
+++ b/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentAdapter.kt
@@ -36,7 +36,7 @@ class StairsCommentAdapter(context: Context,
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is StairsCommentViewHolder) {
val commentEntity = mEntityList[position]
- holder.initCommentViewHolder(holder, mViewModel, commentEntity, mEntrance, mIsShowingConversation,mCommentOptionClickListener,mCommentCallBackListener)
+ holder.initCommentViewHolder(holder, mViewModel, commentEntity, mEntrance, mIsShowingConversation, mCommentOptionClickListener, mCommentCallBackListener)
} else if (holder is FooterViewHolder) {
initFooterViewHolder(holder)
}
diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentFragment.kt
index 6d2ab02126..3c85671e5d 100644
--- a/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentFragment.kt
+++ b/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentFragment.kt
@@ -23,8 +23,8 @@ class StairsCommentFragment : NewCommentFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- reuseNetworkErrorIv.setImageDrawable(ContextCompat.getDrawable(requireContext(),R.drawable.reuse_network_error_dark))
- reuseNoneDataIv.setImageDrawable(ContextCompat.getDrawable(requireContext(),R.drawable.reuse_blank_hint_dark))
+ reuseNetworkErrorIv.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.reuse_network_error_dark))
+ reuseNoneDataIv.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.reuse_blank_hint_dark))
}
override fun provideListAdapter(): ListAdapter<*> {
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 ebeab2d4c1..7c9becd5ca 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
@@ -43,7 +43,7 @@ class StairsCommentReplyAdapter(context: Context, val mViewModel: NewCommentView
holder.initCommentViewHolder(holder, mViewModel, replyCommentEntity, mEntrance, mIsShowingConversation, mCommentOptionClickListener, mCommentCallBackListener)
val commentContainerParams = holder.binding.commentContainer.layoutParams as LinearLayout.LayoutParams
- commentContainerParams.topMargin = 4f.dip2px()
+ commentContainerParams.topMargin = 16f.dip2px()
holder.binding.commentContainer.layoutParams = commentContainerParams
val commentIconContainerParams = holder.binding.commentIconContainer.layoutParams as RelativeLayout.LayoutParams
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 44c02dc84c..e06447db1a 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
@@ -103,24 +103,25 @@ class StairsCommentViewHolder(val binding: StairsCommentItemBinding, val isReply
val context = holder.binding.root.context
var isChildLongClick = false
holder.setCommentUserView(binding.root.context, commentEntity)
+ val params = holder.binding.commentContainer.layoutParams as LinearLayout.LayoutParams
if (isReplyComment) {
- val params = holder.binding.commentContainer.layoutParams as LinearLayout.LayoutParams
params.leftMargin = 0
params.rightMargin = 0
- holder.binding.commentContainer.layoutParams = params
holder.binding.replyContainer.visibility = View.GONE
} else {
+ commentEntity.reply = commentEntity.reply - (commentEntity.subCommentList?.size ?: 0)
+ params.bottomMargin = if (commentEntity.reply > 0) {
+ 16f.dip2px()
+ } else {
+ 24f.dip2px()
+ }
initStairsReplyComment(holder, mViewModel, commentEntity, mEntrance, mIsShowingConversation, mCommentOptionClickListener, mCommentCallBackListener)
}
+ holder.binding.commentContainer.layoutParams = params
if (!TextUtils.isEmpty(mViewModel.videoId)) {
val spannable = TextHelper.getHighlightedSpannableStringThatIsWrappedInsideWrapper(context, commentEntity.content
?: "")
- spannable.append(" ${CommentUtils.getCommentTime(commentEntity.time)}")
- spannable.setSpan(ForegroundColorSpan(ContextCompat.getColor(context, R.color.text_999999)), commentEntity.content?.length
- ?: 0, spannable.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
- spannable.setSpan(AbsoluteSizeSpan(12f.sp2px()), commentEntity.content?.length
- ?: 0, spannable.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
if (commentEntity.priority != 0) {
spannable.append(" ")
spannable.setSpan(CenterImageSpan(HaloApp.getInstance().application, R.drawable.ic_comment_top), spannable.length - 1, spannable.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
@@ -129,6 +130,7 @@ class StairsCommentViewHolder(val binding: StairsCommentItemBinding, val isReply
} else {
holder.binding.commentContent.text = commentEntity.content
}
+ CommentUtils.setCommentTime(holder.binding.commentTime, commentEntity.time)
val key = when (mEntrance) {
"(答案详情-评论列表)" -> "回答详情-评论管理"
@@ -188,7 +190,6 @@ class StairsCommentViewHolder(val binding: StairsCommentItemBinding, val isReply
private fun initStairsReplyComment(holder: StairsCommentViewHolder, mViewModel: NewCommentViewModel, commentEntity: CommentEntity,
mEntrance: String, mIsShowingConversation: Boolean, mCommentOptionClickListener: OnCommentOptionClickListener?,
mCommentCallBackListener: OnCommentCallBackListener) {
- commentEntity.reply = commentEntity.reply - (commentEntity.subCommentList?.size ?: 0)
holder.binding.replyContainer.visibility = if (commentEntity.reply > 0 || !commentEntity.subCommentList.isNullOrEmpty()) View.VISIBLE else View.GONE
holder.binding.expandMoreLl.visibility = if (commentEntity.reply > 0) View.VISIBLE else View.GONE
var stairsCommentReplyAdapter: StairsCommentReplyAdapter?
diff --git a/app/src/main/res/layout/stairs_comment_item.xml b/app/src/main/res/layout/stairs_comment_item.xml
index 1e4717b1e2..e5a4baff7f 100644
--- a/app/src/main/res/layout/stairs_comment_item.xml
+++ b/app/src/main/res/layout/stairs_comment_item.xml
@@ -12,8 +12,7 @@
android:id="@+id/commentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="16dp"
- android:layout_marginTop="12dp">
+ android:layout_marginLeft="16dp">
+
@@ -170,7 +178,6 @@
android:layout_height="wrap_content"
android:layout_below="@+id/comment_username_and_time"
android:layout_marginLeft="40dp"
- android:layout_marginBottom="12dp"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
@@ -182,10 +189,11 @@
+ android:orientation="horizontal"
+ android:layout_marginTop="8dp">