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) } }