diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt index 9c43f9c22a..d7ca67cabb 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt @@ -24,7 +24,9 @@ class RatingAdapter(context: Context, var ratingData: Rating? = null val path = "游戏详情:评分" - val headDataPosition = -1 + + val headServiceCommentPosition = -1 + val headMyCommentPosition = -2 public override fun setListData(updateData: MutableList) { var oldSize = TOP_ITEM_COUNT @@ -104,14 +106,14 @@ class RatingAdapter(context: Context, } if (ratingData?.serviceComment != null) { includeServiceComment.commentItem.visibility = View.VISIBLE - initRatingComment(RatingCommentItemViewHolder(includeServiceComment), ratingData?.serviceComment!!, headDataPosition) + initRatingComment(RatingCommentItemViewHolder(includeServiceComment), ratingData?.serviceComment!!, headServiceCommentPosition) } else { includeServiceComment.commentItem.visibility = View.GONE } if (ratingData?.myComment != null) { includeMyComment.commentItem.visibility = View.VISIBLE - initRatingComment(RatingCommentItemViewHolder(includeMyComment), ratingData?.serviceComment!!, headDataPosition) + initRatingComment(RatingCommentItemViewHolder(includeMyComment), ratingData?.myComment!!, headMyCommentPosition) } else { includeMyComment.commentItem.visibility = View.GONE } @@ -217,13 +219,15 @@ class RatingAdapter(context: Context, fun handleSyncData(intent: Intent?) { SyncDataBetweenPageHelper.resultHandle(intent, object : OnSyncCallBack { override fun onData(dataPosition: Int): RatingComment? { - if (dataPosition == headDataPosition) return ratingData?.serviceComment + if (dataPosition == headServiceCommentPosition) return ratingData?.serviceComment + if (dataPosition == headMyCommentPosition) return ratingData?.myComment return mEntityList[dataPosition] } override fun onNotify(dataPosition: Int) { - if (dataPosition == headDataPosition) notifyItemChanged(0) - else notifyItemChanged(dataPosition + 1) + if (dataPosition == headServiceCommentPosition || dataPosition == headMyCommentPosition) { + notifyItemChanged(0) + } else notifyItemChanged(dataPosition + 1) } }) }