From 7ee991396434b344a0e7a44bdfc8d27568c0bcb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E5=AD=90=E7=BB=B4?= Date: Mon, 1 Aug 2022 17:27:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E6=9F=A5=E7=9C=8B=E5=A4=A7=E5=9B=BE=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E5=8A=A8=E7=94=BB=E4=BD=8D=E7=BD=AE=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qa/comment/CommentPictureAdapter.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/CommentPictureAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/CommentPictureAdapter.kt index 84b3a74f01..85fa27e773 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/CommentPictureAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/CommentPictureAdapter.kt @@ -1,12 +1,15 @@ package com.gh.gamecenter.qa.comment import android.content.Context +import android.util.SparseArray +import android.view.View import android.view.ViewGroup +import androidx.core.util.forEach import androidx.recyclerview.widget.RecyclerView import com.facebook.drawee.view.SimpleDraweeView +import com.gh.gamecenter.ImageViewerActivity import com.gh.gamecenter.common.utils.ImageUtils import com.gh.gamecenter.common.utils.toBinding -import com.gh.gamecenter.ImageViewerActivity import com.gh.gamecenter.databinding.ItemCommentPictureBinding import com.lightgame.adapter.BaseRecyclerAdapter @@ -14,7 +17,7 @@ class CommentPictureAdapter(val context: Context, var pictureList: ArrayList(context) { private var countAndKey: Pair? = null - private val imageViewList = mutableListOf() + private val mImageViewArray = SparseArray() init { var dataIds = "" @@ -33,12 +36,14 @@ class CommentPictureAdapter(val context: Context, var pictureList: ArrayList() + mImageViewArray.forEach { _, value -> + imageViewList.add(value) + } val intent = ImageViewerActivity.getIntent(context, pictureList, position, imageViewList, entrance) context.startActivity(intent) } - if (!imageViewList.contains(holder.binding.commentPicture)) { - imageViewList.add(holder.binding.commentPicture) - } + mImageViewArray.put(position, holder.binding.commentPicture) } }