Search code examples
javaandroidthumbnailsdeprecatedandroid-glide

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.


Solution

  • 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 .