Glide: Help with migration of commands version 3 to 4

Created on 26 Oct 2017  路  2Comments  路  Source: bumptech/glide

I was using version 3.8.0 and after upgrading to 4.2.0 I could not carry the following commands for the new version. I could not find the necessary steps:

Image with progress and cache function

Glide.with(context)
                .load(url)
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .dontAnimate()
                .listener(object : RequestListener<String, GlideDrawable> {

                    override fun onException(e: Exception?, model: String?,
                                             target: Target<GlideDrawable>?,
                                             isFirstResource: Boolean): Boolean {

                        TimberHelper.e(AppConstants.ERROR, "setGameImage - onException " + e.toString())

                        if (itemView.progressBar != null) {
                            itemView.progressBar!!.visibility = View.VISIBLE
                        }
                        return false
                    }

                    override fun onResourceReady(resource: GlideDrawable?,
                                                 model: String?,
                                                 target: Target<GlideDrawable>?,
                                                 isFromMemoryCache: Boolean,
                                                 isFirstResource: Boolean): Boolean {

                        if (itemView.progressBar != null) {
                            itemView.progressBar!!.visibility = View.GONE
                        }

                        return false

                    }

                })
                .into(itemView.ivGameImage)

Load Bitmap with this configuration:

Glide.
                with(this).
                load(image).
                asBitmap().diskCacheStrategy(DiskCacheStrategy.ALL).
                centerCrop().
                dontAnimate().
                override(1080, 675).
                into(object : BitmapImageViewTarget(ivToolbarGame) {
                })
question stale v4

Most helpful comment

All 2 comments

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings