Search code examples
androiduniversal-image-loader

Universal Image Loader using 2 displayer


How can I add a FadeInBitmapDisplayer AND a RoundedBitmapDisplayer to my Image?

This is my DisplayImageOptions

options = new DisplayImageOptions.Builder()
.showStubImage(R.drawable.appwidget
.cacheInMemory().displayer(new FadeInBitmapDisplayer(1500))
.build();

And is it possible somehow to only use the FadeIn Effect once? And if it's loaded and I scroll down my list and scroll back up again it does not FadeIn a second time?

Thanks alot in advance!


Solution

  • How can I add a FadeInBitmapDisplayer AND a RoundedBitmapDisplayer to my Image?

    No way in current version. You can create your own displayer (extend BitmapDisplayer) and copy code from FadeInBitmapDisplayer and RoundedBitmapDisplayer into your class.

    And is it possible somehow to only use the FadeIn Effect once?

    Almost everything is possible :) But it will be not so convenient.

    You can keep displayed images URLs in some map (Map<String, Boolean> = [Image URL<->isDisplayed]) and check this map before imageLoader.displayImage(...) call. If image for current URL is in Map (i.e. image was displayed) then use options with only RoundedBitmapDisplayer. If image for current URL isn't in Map then use options with FadeInBitmapDisplayer+RoundedBitmapDisplayer displayer.