Glide: Glide into() SimpleTarget<File> issue

Created on 24 Jun 2017  路  2Comments  路  Source: bumptech/glide

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!

question v4

Most helpful comment

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>() {})

All 2 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ersen-osman picture ersen-osman  路  3Comments

MrFuFuFu picture MrFuFuFu  路  3Comments

billy2271 picture billy2271  路  3Comments

Tryking picture Tryking  路  3Comments

Anton111111 picture Anton111111  路  3Comments