Android Studio 3.0 Canary 4 Kotlin
Glide Version:4.0.0-RC1
My issue is downloadOnly() is deprecated so I want to try to use into() into a SimpleTarget<File>.
Deprecated code:
Glide.with(this)
.load(glideUrl)
.apply(requestOptions)
.downloadOnly(object : SimpleTarget<File>(){
override fun onResourceReady(resource: File?, transition: Transition<in File>?) {
//handle resource
}
})
Desired code:
Glide.with(this)
.load(glideUrl)
.apply(requestOptions)
.into(object : SimpleTarget<File>(){
override fun onResourceReady(resource: File?, transition: Transition<in File>?) {
//handle resource
}
})
Error message:
None of the following functions can be called with the arguments supplied:
public open fun <Y : Target<Drawable!>!> into(@NonNull target: ???): (???..???) defined in com.bumptech.glide.RequestBuilder
public open fun into(view: ImageView!): Target<Drawable!>! defined in com.bumptech.glide.RequestBuilder
Problem: into() will not accept SimpleTarget<File>, but downloadOnly() does accept it. I would like Glide to fetch an image, cache it, and provide me a File so that I may retrieve the Uri and process it.
If you are wondering about my use case, I am trying to implement Glide with this library https://github.com/davemorrissey/subsampling-scale-image-view
The image source can not be Bitmap or else features (tiling) will be missing so I require a Uri.
Any help would be appreciated, thank you!
It's still there, just read the deprecation notice on the methods' JavaDoc.
Glide
.with(context)
.downloadOnly() // notice this is much earlier in the chain
.load(url)
.apply(requestOptions)
.into(new SimpleTarget<File>() {})
Thank you!
Most helpful comment
It's still there, just read the deprecation notice on the methods' JavaDoc.