修复点击预览图片position错误问题

This commit is contained in:
张玉久
2020-12-17 17:24:19 +08:00
parent 9f5940c6f6
commit 80a2e4f336

View File

@ -48,6 +48,7 @@ class ImageContainerView : LinearLayout {
visibility = View.GONE
return
}
visibility = View.VISIBLE
if (mAnswerEntity?.type == "community_article") {
//文章内只有视频
if (entity.getPassVideos().isNotEmpty() && entity.images.isEmpty()) {
@ -131,7 +132,11 @@ class ImageContainerView : LinearLayout {
displayImage(binding, url, width.toFloat(), height.toFloat(), isChangeRatio)
binding.root.setOnClickListener {
if (mAnswerEntity == null) return@setOnClickListener
val position = if (mAnswerEntity!!.getPassVideos().isNullOrEmpty()) binding.root.tag as Int else (binding.root.tag as Int) - 1
val position = if (mAnswerEntity?.type == "community_article") {
binding.root.tag as Int
} else {
if (mAnswerEntity!!.getPassVideos().isNullOrEmpty()) binding.root.tag as Int else (binding.root.tag as Int) - 1
}
val intent = ImageViewerActivity.getIntent(context, mAnswerEntity!!.images as ArrayList<String>, position, binding.root, mEntrance)
context.startActivity(intent)
}