修改视频评论UI
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
@ -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<*> {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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?
|
||||
|
||||
Reference in New Issue
Block a user