光环助手V4.1.0-游戏评论功能强化20200730测试问题 https://gitlab.ghzs.com/pm/halo-app-issues/-/issues/925

This commit is contained in:
张玉久
2020-07-30 18:09:07 +08:00
parent 0398cc4ffc
commit 738074ec00
4 changed files with 27 additions and 24 deletions

View File

@ -287,26 +287,24 @@ class DescAdapter(context: Context,
viewHolder.binding.containerPaddingBottom = itemData.paddingBottom
viewHolder.binding.executePendingBindings()
if (viewHolder.binding.recyclerview.adapter == null) {
val commentsAdapter = viewHolder.binding.recyclerview.adapter as DescCommentsAdapter?
?: DescCommentsAdapter(mContext, mViewModel, mEntrance, gameName)
viewHolder.binding.recyclerview.background = ContextCompat.getDrawable(mContext, R.drawable.background_shape_white_radius_5)
viewHolder.binding.recyclerview.isNestedScrollingEnabled = false
viewHolder.binding.recyclerview.adapter = commentsAdapter
viewHolder.binding.recyclerview.layoutManager = LinearLayoutManager(mContext)
val itemDecoration = HorizontalDividerItemDecoration.Builder(mContext)
.size(DisplayUtils.dip2px(0.5f))
.margin(DisplayUtils.dip2px(16f))
.color(ContextCompat.getColor(mContext, R.color.text_f5f5f5)).build()
viewHolder.binding.recyclerview.addItemDecoration(itemDecoration)
viewHolder.binding.tvAll.setOnClickListener {
EventBus.getDefault().post(EBReuse(GameDetailFragment.SKIP_RATING))
MtaHelper.onEvent("游戏详情_新", "玩家评论_点击全部", gameName)
MtaHelper.onEvent("游戏详情_新", "玩家评论_更多按钮", gameName)
}
commentsAdapter.comments = comments!!
commentsAdapter.notifyDataSetChanged()
val commentsAdapter = viewHolder.binding.recyclerview.adapter as DescCommentsAdapter?
?: DescCommentsAdapter(mContext, mViewModel, mEntrance, gameName)
viewHolder.binding.recyclerview.background = ContextCompat.getDrawable(mContext, R.drawable.background_shape_white_radius_5)
viewHolder.binding.recyclerview.isNestedScrollingEnabled = false
viewHolder.binding.recyclerview.adapter = commentsAdapter
viewHolder.binding.recyclerview.layoutManager = LinearLayoutManager(mContext)
val itemDecoration = HorizontalDividerItemDecoration.Builder(mContext)
.size(DisplayUtils.dip2px(0.5f))
.margin(DisplayUtils.dip2px(16f))
.color(ContextCompat.getColor(mContext, R.color.text_f5f5f5)).build()
viewHolder.binding.recyclerview.addItemDecoration(itemDecoration)
viewHolder.binding.tvAll.setOnClickListener {
EventBus.getDefault().post(EBReuse(GameDetailFragment.SKIP_RATING))
MtaHelper.onEvent("游戏详情_新", "玩家评论_点击全部", gameName)
MtaHelper.onEvent("游戏详情_新", "玩家评论_更多按钮", gameName)
}
commentsAdapter.comments = comments!!
commentsAdapter.notifyDataSetChanged()
}
//绑定其他相关版本

View File

@ -188,6 +188,7 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
more.setOnClickListener {
if (path == "游戏详情:评分") MtaHelper.onEvent("游戏详情_新", "评论Tab_更多按钮", game?.name)
if (path == "折叠评论") MtaHelper.onEvent("折叠评论", "点击更多", game?.name)
showMorePopWindow(it, commentData.user.id == UserManager.getInstance().userId) { text ->
when (text) {
"复制" -> {

View File

@ -68,7 +68,7 @@ class RatingReplyActivity : ListActivity<RatingReplyEntity, RatingReplyViewModel
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == RatingFragment.RATING_PATCH_REQUEST && resultCode == Activity.RESULT_OK) {
mAdapter?.handleSyncData(data)
mAdapter?.handleSyncData(requestCode, data)
}
}

View File

@ -452,7 +452,7 @@ class RatingReplyAdapter(context: Context,
Picasso.with(mContext).load(Uri.parse(it)).priority(Picasso.Priority.HIGH).get()
}.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe ({
.subscribe({
val bitmapDrawable = BitmapDrawable(mContext.resources, it)
bitmapDrawable.setBounds(0, 0, DensityUtil.dip2px(16F), DensityUtil.dip2px(16F))
replyNameSpannable.setSpan(CenterImageSpan(bitmapDrawable), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
@ -471,16 +471,20 @@ class RatingReplyAdapter(context: Context,
}, startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
userName.movementMethod = CustomLinkMovementMethod.getInstance()
userName.text = replyNameSpannable
},{
}, {
it.printStackTrace()
})
}
fun handleSyncData(intent: Intent?) {
fun handleSyncData(requestCode: Int, intent: Intent?) {
SyncDataBetweenPageHelper.resultHandle(intent, object : OnSyncCallBack<RatingComment> {
override fun onData(dataPosition: Int): RatingComment? {
if (dataPosition >= mEntityList.size) return null
return mEntityList[dataPosition].comment
val comment = mEntityList[dataPosition].comment
if (requestCode == RatingFragment.RATING_PATCH_REQUEST) {
comment?.ignore = viewModel.game?.ignoreComment ?: false
}
return comment
}
override fun onNotify(dataPosition: Int) {