【光环助手V_4.7.0】论坛交互优化(0128测试反馈) https://git.ghzs.com/pm/halo-app-issues/-/issues/1135

This commit is contained in:
张玉久
2021-02-01 09:21:22 +08:00
parent 7123b3d59a
commit 45a84fc45c
5 changed files with 33 additions and 18 deletions

View File

@ -729,6 +729,7 @@ class AnswerDetailFragment : NormalFragment() {
R.id.reuse_no_connection,
R.id.status_tv,
R.id.bottomLikeIv,
R.id.bottomCommentIv,
R.id.answer_count_container,
R.id.follow_tv,
R.id.user_icon_iv,
@ -785,12 +786,16 @@ class AnswerDetailFragment : NormalFragment() {
}
}
}
R.id.bottomCommentIv -> {
showCommentDialog(false)
}
R.id.replyTv -> {
mViewModel.answerDetail?.run {
if (commentable) {
DataUtils.onMtaEvent(context, "详情页面", "答案评论详情", content.subStringIfPossible(30))
showCommentDialog(false)
// showCommentDialog(false)
showCommentDialog(true)
} else {
toast("作者已关闭评论")
}
@ -926,11 +931,11 @@ class AnswerDetailFragment : NormalFragment() {
}
}
private fun showCommentDialog(showKeyBoard: Boolean) {
private fun showCommentDialog(showInputOnly: Boolean) {
val intent = CommentActivity.getAnswerCommentIntent(requireContext(),
mAnswerId,
mViewModel.answerDetail?.commentCount ?: 0,
showKeyBoard)
showInputOnly, showInputOnly)
requireActivity().startActivityForResult(intent, CommentActivity.REQUEST_CODE)
}

View File

@ -95,17 +95,10 @@ class ArticleDetailContentViewHolder(var binding: ItemArticleDetailContentBindin
followBtn.visibility = View.VISIBLE
if (article.user.id == UserManager.getInstance().userId) {
followBtn.isEnabled = false
followBtn.setText(R.string.myself)
followBtn.setTextColor(ContextCompat.getColor(root.context, R.color.button_gray))
followBtn.setBackgroundResource(R.drawable.button_border_gray)
followBtn.visibility = View.GONE
} else {
followBtn.isEnabled = true
if (article.me.isFollower) {
followBtn.visibility = View.GONE
} else {
updateFollowBtn(false)
}
updateFollowBtn(article.me.isFollower)
}
badgeIv.goneIf(article.user.badge == null)

View File

@ -242,11 +242,10 @@ abstract class BaseArticleDetailCommentAdapter(context: Context,
bindComment(binding, viewModel, comment, entrance, deleteCallBack)
if (type == AdapterType.COMMENT) {
// 帖子详情页面用的样式
updateSubComment(comment.subCommentList, viewModel.topItemData?.articleDetail?.user?.id
?: "")
updateSubComment(comment, viewModel, entrance)
binding.floorHintTv.text = if (comment.floor != 0) "${comment.floor}" else ""
binding.root.setOnClickListener {
CommentActivity.getArticleDetailCommentIntent(binding.root.context, comment.id!!, viewModel.communityId, viewModel.articleId, false, comment.floor, entrance, PATH_ARTICLE_DETAIL).apply {
CommentActivity.getArticleCommentIntent(binding.root.context, viewModel.articleId, viewModel.commentCount, true, viewModel.communityId, comment, true).apply {
binding.root.context.startActivity(this)
}
MtaHelper.onEvent("帖子详情", "全部评论", "评论正文")
@ -265,7 +264,7 @@ abstract class BaseArticleDetailCommentAdapter(context: Context,
binding.commentCountTv.setOnClickListener { commentClosure?.invoke(comment) }
binding.commentCountTv.setCompoundDrawables(null, null, null, null)
binding.commentCountTv.text = "回复"
binding.root.setOnClickListener { binding.moreIv.performClick() }
binding.root.setOnClickListener { binding.commentCountTv.performClick() }
if (comment.parentUser != null) {
val prefix = "回复"
@ -300,7 +299,11 @@ abstract class BaseArticleDetailCommentAdapter(context: Context,
}
@SuppressLint("SetTextI18n")
fun updateSubComment(subCommentList: ArrayList<CommentEntity>?, articleOwnerUserId: String) {
fun updateSubComment(comment: CommentEntity, viewModel: BaseArticleDetailCommentViewModel, entrance: String) {
val subCommentList = comment.subCommentList
val articleOwnerUserId = viewModel.topItemData?.articleDetail?.user?.id ?: ""
binding.moreSubCommentBtn.goneIf(comment.reply < 3)
binding.moreSubCommentBtn.text = "查看全部${comment.reply}条回复"
binding.subCommentContainer.goneIf(subCommentList.isNullOrEmpty())
binding.firstSubCommentTv.goneIf(subCommentList?.firstOrNull() == null)
binding.secondSubCommentTv.goneIf(subCommentList?.secondOrNull() == null)
@ -312,6 +315,11 @@ abstract class BaseArticleDetailCommentAdapter(context: Context,
subCommentList?.secondOrNull()?.let {
binding.secondSubCommentTv.text = getSubCommentSpanned(it.user.name, if (it.user.id == articleOwnerUserId) "作者" else "", it.content)
}
binding.subCommentContainer.setOnClickListener {
CommentActivity.getArticleDetailCommentIntent(binding.root.context, comment.id!!, viewModel.communityId, viewModel.articleId, false, comment.floor, entrance, PATH_ARTICLE_DETAIL).apply {
binding.root.context.startActivity(this)
}
}
}
private fun getSubCommentSpanned(name: String?, author: String?, content: String?): SpannableStringBuilder {

View File

@ -69,6 +69,7 @@ class CommentActivity : BaseActivity() {
answerId,
showKeyboard,
commentCount,
mShowInputOnly,
commentCallback)
} else if (!articleId.isNullOrEmpty()) {
NewCommentFragment.getCommunityArticleCommentInstance(
@ -142,10 +143,16 @@ class CommentActivity : BaseActivity() {
@JvmStatic
fun getAnswerCommentIntent(context: Context, answerId: String, commentCount: Int? = 0, showKeyboard: Boolean): Intent {
return getAnswerCommentIntent(context, answerId, commentCount, showKeyboard, false)
}
@JvmStatic
fun getAnswerCommentIntent(context: Context, answerId: String, commentCount: Int? = 0, showKeyboard: Boolean, showInputOnly: Boolean = false): Intent {
val intent = Intent(context, CommentActivity::class.java)
intent.putExtra(ANSWER_ID, answerId)
intent.putExtra(COMMENT_COUNT, commentCount)
intent.putExtra(SHOW_KEYBOARD, showKeyboard)
intent.putExtra(SHOW_INPUT_ONLY, showInputOnly)
if (context is Activity) {
context.overridePendingTransition(0, 0)
}

View File

@ -544,6 +544,7 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
fun getAnswerCommentInstance(answerId: String,
showSoftKeyboardOnStartUp: Boolean,
commentCount: Int,
showInputOnly:Boolean,
listener: AnswerDetailFragment.CommentListener)
: NewCommentFragment {
return NewCommentFragment().apply {
@ -552,7 +553,8 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
SHOW_SOFT_KEY_BOARD_ON_STARTUP to showSoftKeyboardOnStartUp,
ANSWER_ID to answerId,
COMMENT_COUNT to commentCount,
COMMENT_TYPE to CommentType.ANSWER
COMMENT_TYPE to CommentType.ANSWER,
SHOW_INPUT_ONLY to showInputOnly
))
}
}