光环助手V4.2.0-问答首页优化20200824测试(2,5,6,7) https://gitlab.ghzs.com/pm/halo-app-issues/-/issues/955
This commit is contained in:
@ -56,11 +56,11 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
|
||||
|
||||
binding.userIcon.setOnClickListener {
|
||||
MtaHelper.onEvent(getEventId(BaseActivity.mergeEntranceAndPath(entrance, path)), getKey(BaseActivity.mergeEntranceAndPath(entrance, path)), "用户头像")
|
||||
DirectUtils.directToHomeActivity(binding.root.context, entity.user.id, entrance, path)
|
||||
DirectUtils.directToHomeActivity(binding.root.context, entity.user.id, 1, entrance, path)
|
||||
}
|
||||
binding.userName.setOnClickListener {
|
||||
MtaHelper.onEvent(getEventId(BaseActivity.mergeEntranceAndPath(entrance, path)), getKey(BaseActivity.mergeEntranceAndPath(entrance, path)), "用户名字")
|
||||
DirectUtils.directToHomeActivity(binding.root.context, entity.user.id, entrance, path)
|
||||
DirectUtils.directToHomeActivity(binding.root.context, entity.user.id, 1, entrance, path)
|
||||
}
|
||||
binding.executePendingBindings()
|
||||
}
|
||||
@ -69,10 +69,10 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
|
||||
if (entity.type == "community_article") {
|
||||
binNormalView(entity)
|
||||
} else {
|
||||
if (entity.commentCount>0){
|
||||
if (entity.commentCount > 0) {
|
||||
commentCount.text = entity.commentCount.toString()
|
||||
commentCount.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(itemView.context, R.drawable.community_question_answer_count), null, null, null)
|
||||
}else {
|
||||
} else {
|
||||
commentCount.text = "我来回答"
|
||||
commentCount.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(itemView.context, R.drawable.community_question_answer_edit), null, null, null)
|
||||
}
|
||||
@ -90,9 +90,9 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
|
||||
entity.commentCount,
|
||||
entity.commentCount == 0, communityId)
|
||||
itemView.context.startActivity(intent)
|
||||
MtaHelper.onEvent(getEventId(entrance),getKey(entrance),"评论图标")
|
||||
MtaHelper.onEvent(getEventId(entrance), getKey(entrance), "评论图标")
|
||||
} else {
|
||||
MtaHelper.onEvent(getEventId(entrance),getKey(entrance),"我来回答")
|
||||
MtaHelper.onEvent(getEventId(entrance), getKey(entrance), "我来回答")
|
||||
val intent = AnswerEditActivity.getIntent(it.context, entity.questions, entity.communityName)
|
||||
itemView.context.startActivity(intent)
|
||||
}
|
||||
@ -105,11 +105,11 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
|
||||
debounceActionWithInterval(R.id.container_like, 1000) {
|
||||
CheckLoginUtils.checkLogin(itemView.context, entrance) {
|
||||
if (entity.type == "community_article") {
|
||||
MtaHelper.onEvent(getEventId(entrance),getKey(entrance),"点赞图标")
|
||||
MtaHelper.onEvent(getEventId(entrance), getKey(entrance), "点赞图标")
|
||||
if (!voteIcon.isChecked) voteAnswer(entity)
|
||||
else cancelAnswerVote(entity)
|
||||
} else {
|
||||
MtaHelper.onEvent(getEventId(entrance),getKey(entrance),"邀请回答")
|
||||
MtaHelper.onEvent(getEventId(entrance), getKey(entrance), "邀请回答")
|
||||
val questionsDetailEntity = QuestionsDetailEntity(
|
||||
id = entity.questions.id,
|
||||
title = entity.questions.title,
|
||||
|
||||
@ -19,11 +19,24 @@ import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
|
||||
class ForumFollowAdapter(context: Context) : BaseRecyclerAdapter<RecyclerView.ViewHolder>(context) {
|
||||
val entityList: ArrayList<ForumEntity> = arrayListOf()
|
||||
private var countAndKey: Pair<Int, String>? = null
|
||||
|
||||
fun setListData(data: List<ForumEntity>) {
|
||||
fun setListData(datas: List<ForumEntity>) {
|
||||
checkResetData(datas)
|
||||
}
|
||||
|
||||
fun checkResetData(datas: List<ForumEntity>) {
|
||||
var dataIds = ""
|
||||
datas.forEach {
|
||||
dataIds += it.id
|
||||
}
|
||||
entityList.clear()
|
||||
entityList.addAll(data)
|
||||
notifyDataSetChanged()
|
||||
entityList.addAll(datas)
|
||||
if (countAndKey?.first != datas.size || countAndKey?.second != dataIds) {
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
// 重新刷新数据标识
|
||||
countAndKey = Pair(datas.size, dataIds)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
|
||||
@ -5,10 +5,7 @@ import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.base.BaseRecyclerViewHolder
|
||||
import com.gh.common.util.DialogUtils
|
||||
import com.gh.common.util.MtaHelper
|
||||
import com.gh.common.util.debounceActionWithInterval
|
||||
import com.gh.common.util.ifLogin
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.databinding.ForumItemBinding
|
||||
import com.gh.gamecenter.entity.ForumEntity
|
||||
@ -48,11 +45,12 @@ class ForumAdapter(context: Context, val mViewModel: ForumSelectViewModel?) : Ba
|
||||
mContext.ifLogin("论坛-选择论坛") {
|
||||
debounceActionWithInterval(it.id) {
|
||||
if (forumEntity.isFollow) {
|
||||
DialogUtils.showAlertDialog(mContext, "提示", "确定要取消关注论坛吗?", "确定", "暂不", {
|
||||
DialogUtils.showAlertDialog(mContext, "提示", "取消关注论坛", "确定", "暂不", {
|
||||
mViewModel?.unFollowForum(forumEntity.id) {
|
||||
MtaHelper.onEvent("论坛首页", "选择论坛", "关注")
|
||||
forumEntity.isFollow = false
|
||||
holder.binding.followTv.text = "关注"
|
||||
ToastUtils.showToast("已取消关注")
|
||||
holder.binding.followTv.background = ContextCompat.getDrawable(mContext, R.drawable.bg_forum_follow)
|
||||
holder.binding.followTv.setTextColor(ContextCompat.getColor(mContext, R.color.theme_font))
|
||||
EventBus.getDefault().post(EBForumFollowChange(forumEntity, false))
|
||||
@ -64,6 +62,7 @@ class ForumAdapter(context: Context, val mViewModel: ForumSelectViewModel?) : Ba
|
||||
MtaHelper.onEvent("论坛首页", "选择论坛", "已关注")
|
||||
forumEntity.isFollow = true
|
||||
holder.binding.followTv.text = "已关注"
|
||||
ToastUtils.showToast("关注成功")
|
||||
holder.binding.followTv.background = ContextCompat.getDrawable(mContext, R.drawable.bg_shape_f5_radius_999)
|
||||
holder.binding.followTv.setTextColor(ContextCompat.getColor(mContext, R.color.text_999999))
|
||||
EventBus.getDefault().post(EBForumFollowChange(forumEntity, true))
|
||||
|
||||
Reference in New Issue
Block a user