MostafaGazar / CustomShapeImageView

A library for supporting custom shaped ImageView(s) using SVGs and paint shapes
http://mostafagazar.github.io/CustomShapeImageView
Apache License 2.0
1.62k stars 425 forks source link

Images show up translucent. Get corrected on going back and opening the screen again #5

Open ghost opened 9 years ago

ghost commented 9 years ago

When the grid/list is created for the first time and images loaded into the image view via Picasso's lazy loading library, the images show up translucent. I set a placeholder image by default for all the image views and then lazy load the downloaded images into the same image view.

If I go back to the previous screen and open the screen again, all images show up correctly.

Am I doing anything wrong by setting a default placeholder image? Or is the lazy loading library - Picasso causing this?

kibotu commented 8 years ago

having the same issue, first loading shows transparent images for some reason :(

kibotu commented 8 years ago

for whatever reason it works like a charm with Glide

kibotu commented 8 years ago

actually this does the trick as well: https://gist.github.com/kibotu/972548c9c36e95452ab7

HGyllensvard commented 6 years ago

This is something I just experienced as well when using:

Picasso.load(resId).error(fallback).into(theImageView)

Not sure why, but this is a workaround for now:

Target target = new Target() {
            @Override
            public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
                imageView.setImageBitmap(bitmap);
            }

            @Override
            public void onBitmapFailed(Drawable errorDrawable) {
                imageView.setImageDrawable(errorDrawable);
            }

            @Override
            public void onPrepareLoad(Drawable placeHolderDrawable) {

            }
        };

imageView.setTag(target);  
loadLocalFile(path).error(fallback).into(target);

Note that the setTag is done because Picasso only got a weak reference to the Target, so this will make sure it is not garbage collected while loading in the image in the background.