Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
834 B
2
Indexable
Never
override fun instantiateItem(container: ViewGroup, position: Int): Any {
        val itemView = inflateBinding<ItemRoomPhotoBinding>(LayoutInflater.from(context), container)
        val photoUrl = getItem(position)?.photoUrl?.large ?: ""
        itemView.run {
            glideImageLoader.loadImageUrl(photoImageView, photoUrl) { width, height ->
                if (height > width) {
                    photoImageView.scaleType = ImageView.ScaleType.FIT_CENTER
                    setBlurImage(photoBackgroundImageView, photoUrl)
                } else {
                    photoImageView.scaleType = ImageView.ScaleType.CENTER_CROP
                }
            }

            root.setOnClickListener {
                imageClickListener()
            }
            container.addView(root)
            return root
        }
    }
Leave a Comment