Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glide 4.13.0 : thumbnail(float) is deprecated

Just updated Glide to Version 4.13.0 and getting this deprecation warning.

On checking the release page, I found this:enter image description here

So, what should be the appropriate equivalent to this part of code?

GlideApp.with(holder.itemView.getContext())
            .load(sr)
            .thumbnail(0.2f)
            .placeholder(R.drawable.background_splash)
            .into(holder.album);

What I tried: enter image description here

I think the syntax should be something like this but confused on what to pass to the constructor.

like image 232
Sujal Kumar Avatar asked Nov 24 '25 20:11

Sujal Kumar


1 Answers

With RequestBuilder you can configure the request for thumbnail with a multiplier. below is an example

 RequestBuilder<Drawable> requestBuilder= GlideApp.with(holder.itemView.getContext())
            .asDrawable().sizeMultiplier(0.1f);
 GlideApp.with(holder.itemView.getContext())
            .load(sr)
            .thumbnail(requestBuilder)
            .placeholder(R.drawable.background_splash)
            .into(holder.album);

its should work . just play around with it to explore more options .

like image 173
ADM Avatar answered Nov 26 '25 11:11

ADM