Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animation Transition with UniversalImageLoader #20

Closed
alexstyl opened this issue Sep 8, 2014 · 2 comments
Closed

Animation Transition with UniversalImageLoader #20

alexstyl opened this issue Sep 8, 2014 · 2 comments

Comments

@alexstyl
Copy link

alexstyl commented Sep 8, 2014

I am trying to set a custom animation when a drawable is set on the CircleImageView, but the view doesn't seem to be refreshed whenever it has finished loading. I am using the view on each of my adapter's rows. The view seems to be stuck with the default drawable it has before I request the Universal Image Loader to load, and it is only updated whenever I cause the row to be recycled (scroll it away and then back in)

here is the code of the displayer:

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {


    if ((loadedFrom == LoadedFrom.NETWORK) || (loadedFrom == LoadedFrom.DISC_CACHE)) {

        ImageView imageView = (ImageView) imageAware.getWrappedView();
        Drawable previous = imageView.getDrawable();
        final TransitionDrawable td =
                new TransitionDrawable(new Drawable[]{
                        (previous == null ? transparent : previous),
                        new BitmapDrawable(mResources, bitmap)
                });

        td.setCrossFadeEnabled(true);

        imageAware.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);


    } else {
        imageAware.setImageBitmap(bitmap);
    }

}

Are there any workarounds for this?

@3mph4515
Copy link

You have no need to use custom views with UIL. It can round your images out of box. See displayer method

@hdodenhof
Copy link
Owner

For the root cause please have a look at #3 and #5. Basically CircleImageView gets a static Bitmap from the Drawable you set using setImageDrawable and doesn't care about any changes to it (i.e. a transition) anymore. This is unfortunately a limitation of the current approach of not having some kind of separate CircleImageDrawable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants