GermainGum
GermainGum

Reputation: 1399

modify universal-image-loader

I am using this project universal-image-loader in order to display in a gridview several images. But I would like to modify these images with some html (for example add ads at the bottom of each images).

I saw the image are displayed by calling imageLoader.displayImage(..), in the method getView of the ImageAdapter.

I don't know what approach is better:

I guess I don't have the choice, I have to use a webview.

Moreover in the method displayImage() of ImageLoader.java, i don't understand where the images are loaded, I guess this is somewhere in this line, but when I am looking in these methods I can't find/understand

    ImageSize targetSize = getImageSizeScaleTo(imageView);
    String memoryCacheKey = MemoryCacheUtil.generateKey(uri, targetSize);
    cacheKeysForImageViews.put(imageView.hashCode(), memoryCacheKey);
    Bitmap bmp = configuration.memoryCache.get(memoryCacheKey);

(How from a string built by an uri and ImageSize we can have a bitmap? where is the image?)

Upvotes: 0

Views: 423

Answers (1)

nostra13
nostra13

Reputation: 12407

Images are loaded asynchronously. So your code piece is just a top of complex logic. Main work is done in LoadAndDisplayTask class but you don't need to touch it.

For your case you can create own BitmapDisplayer:

  • create BitmapDisplayer implementation
  • implement Bitmap display(Bitmap bitmap, ImageView imageView) method
  • in this method you can process incoming Bitmap as you want
  • set result Bitmap in ImageView and return result

Set your BitmapDisplayer into configuration.

Upvotes: 1

Related Questions