Glide Image Loader : The Impossible
Published in
4 min readApr 15, 2018
This is the last section of the 3 series on Glide Tutorial.
- Glide Image Loading : The Basic
- Glide Image Loading : The Advanced
- Glide Image Loading : The Impossible (This Page)
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
- As we click the image, it will load the next image.
- 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()…