nostra13/Android-Universal-Image-Loader — pull request #314 by fernandocamargoti (2013-06-18 13:46:54+00:00)
Title: Possibility to cache preprocessed image on disc

Hello,

As promised here https://github.com/nostra13/Android-Universal-Image-Loader/issues/309, I've implemented the functionality and made this pull request.

I've tested this with the app I'm developing. I have a listview that is loaded and paginated from the web. When I loaded too many items, each one with its image (some of the images was repeating), the memory cache was becoming full quickly and it was starting to preprocess all the images again, when I scroll up. It was consuming much CPU and memory... and also giving the user the impression that the image was being loaded again. Now, it's putting the preprocessed image on disc cache. So, it's preprocessing the image just one time and it saved me a lot of CPU and memory. At the moment, I tested to load about 800 items in the ListView. Since some images are repeating, I think it's about 300 unique images in the ListView. When I scroll down, more items are loaded. If I scroll up until reach the top, I see all the images quickly, as if it was loaded instantly. And it's scrolling smoothly.

The way I've implemented, it's not going to break any code that uses this new version. I've included a new option called cachePreProcessedImageOnDisc in the DisplayImageOptions. I think that the user usually would use either cacheOnDisc or cachePreProcessedImageOnDisc. If both are activated, the original image will be loaded from the network to the file and then the file will be overwritten with the preprocessed image.

I hope it's useful.