Untitled

 avatar
unknown
plain_text
a year ago
834 B
8
Indexable
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
        }
    }
Editor is loading...
Leave a Comment