Glide Image Loader : The Impossible

This is the last section of the 3 series on Glide Tutorial.

Case for Impossible

We have learnt the Basic of displaying the image. And we have learnt the Advanced of architecting what’s behind. Now let me share with you 2 limitation of Glides and how it could be solved.

Imagine we want to display the view, where

  1. As we click the image, it will load the next image.
  2. The image is shown with Round Corner (we have RoundedCorners(..) transformation class provided by Glide), and have the placeholder image shown behind.

With that, we code as usual, and below is our code in our mainActivity

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

my_image_view.setOnClickListener {
loadImage(imageList[imageIndex++])

my_image_view.isClickable = false
}
}

private fun loadImage(url: String) {

val requestOption = RequestOptions()
.placeholder(R.drawable.placeholder)
.centerCrop()…

--

--