Glide listener doesn't work

It seems to be a bug with ImageView's visibility if it's invisible or gone. I opened an issue here: https://github.com/bumptech/glide/issues/618


Here's one way to do it:

        Glide.with(context).load(...)
                .listener(object : RequestListener<Drawable> {
                    override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean {
                        //TODO handle error images while loading photo
                        return true
                    }

                    override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
                        //TODO use "resource" as the photo for your ImageView
                        return true
                    }

                }).submit()

Ran into same issue. Having onResourceReady return false did the trick for me.