Allow me to introduce EssentialsLoader. EssentialsLoader is my image loading (lazy loading) system that I’ve been using for sometime now. It’s part of the Essentials tools (along with EssentialsLogger) that I’ve created and decided to release publicly. So why did I create my own image loading system when there are others out there such as Loading Large Bitmaps Efficiently from Google? EssentialsLoader address a couple of important issues which most other systems were not handling to my liking.
First, EssentialsLoader decouples the view from the loading process. What does this mean? Take for instance Google’s lib that I linked to above. You are required to reference an ImageView to load a bitmap. Now that’s just down right silly. So to use their lib I’m forced to use an ImageView and I have no control over how or where the loaded image will go! I can’t change the drawable shape; I can’t set it to be a background; I can’t set the scale type on load; and I don’t get a Callback for when it has loaded. But back to my original point. A loading system should not make the assumption of how the loaded image will be used. EssentialsLoader decouples this process and you are free to use the loaded bitmap however you’d like.
Secondly, most loading system do not expose the cache. They are often created internally and you have no way to access them. What if you wanted to share the disk cache across loaders but not the memory cache or vise versa? Or what if you wanted a custom type of cache allowing you to cache and/or reject Bitmaps at your whim? EssentialsLoader allows you to do this by passing in the cache of your choosing in the constructor.
The lack of a good and architecturally flexible system has frustrated me for sometime now (along with the lack of a HorizontalListView….come on guys…). I’m hoping EssentailsLoader can start filling in this void. This post was more of an introduction and I don’t have any follow up post in mind to elaborate on it. So go check out the samples and if there’s an architectural point you’d like for me to address in a blog post feel free to send me a message or leave a comment.