From 5119bdf5456683ea2a1565fa9a22c854e0940468 Mon Sep 17 00:00:00 2001 From: kehaoyuan Date: Thu, 20 Jun 2019 10:04:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E8=AF=84=E8=AE=BA=20?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5=20?= =?UTF-8?q?=E9=80=82=E9=85=8D'=E6=88=91=E7=9A=84=E8=AF=84=E8=AE=BA'?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gamedetail/rating/RatingAdapter.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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) } }) }