'Firebase Image Storage - Thumbnail

I have picasso in my android app, so I can retrieve the image URL from firebase storage to my recyclerview and show it up, now, i want to add a placeholder so users can see when the image is loading, but, I want to do it the way every app does it, first bluring the image like a low size one (thumbnail) , and then show the original one (NOT-BLURED).

I have been searching into Stack Overflow, I found solutions that are great, like, making 2 picasso statements, one for the thumbnail and after that, onsucceed method brings me the original image, but I have a problem, I need 2 images , the thumbnail of the original one to be shown at first and then show the original full image.

So, how can I retrieve 2 images if i just upload one to the server?

Here is a little thing I found in SO:

Transformation blurTransformation = new Transformation() {
    @Override
    public Bitmap transform(Bitmap source) {
        Bitmap blurred = Blur.fastblur(LiveImageView.this.context, source, 10);
        source.recycle();
        return blurred;
    }
 
    @Override
    public String key() {
        return "blur()";
    }
};
 
Picasso.with(context)
    .load(thumbUrl) // thumbnail url goes here
    .placeholder(R.drawable.placeholder)
    .resize(imageViewWidth, imageViewHeight)
    .transform(blurTransformation)
    .into(imageView, new Callback() {
        @Override
        public void onSuccess() {
            Picasso.with(context)
                    .load(url) // image url goes here
                    .resize(imageViewWidth, imageViewHeight)
                    .placeholder(imageView.getDrawable())
                    .into(imageView);
        }
 
        @Override
        public void onError() {
        }
    });


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source