com.xtremelabs.imageutils
Class ImagePrecacheAssistant

java.lang.Object
  extended by com.xtremelabs.imageutils.ImagePrecacheAssistant

public class ImagePrecacheAssistant
extends java.lang.Object

This utility simplifies the process of implementing precaching in adapters for use in widgets such as ListViews and ViewPagers.

Instructions:
Create a new instance of this class from within adapter.
Implement the methods PrecacheInformationProvider#onRowPrecacheRequestsRequired(int) and ImagePrecacheAssistant.PrecacheInformationProvider.getCount().
In the "getView" method of the adapter, call onPositionVisited(int), and pass in the current position.


Nested Class Summary
static interface ImagePrecacheAssistant.PrecacheInformationProvider
          This interface must be implemented in order for the ImagePrecacheAssistant to function.
static class ImagePrecacheAssistant.PrecacheRequest
           
 
Constructor Summary
ImagePrecacheAssistant(AbstractImageLoader imageLoader, ImagePrecacheAssistant.PrecacheInformationProvider precacheInformationProvider)
           
 
Method Summary
 void onPositionVisited(int position)
          This method must be called in the getView method of your adapter.
 void setDiskCacheRange(int range)
          Adjust the number of positions ahead of those that become cached in memory that will be cached on disk.
 void setMemCacheRange(int range)
          Adjust the number of positions ahead that become cached in both the disk and memory caches.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImagePrecacheAssistant

public ImagePrecacheAssistant(AbstractImageLoader imageLoader,
                              ImagePrecacheAssistant.PrecacheInformationProvider precacheInformationProvider)
Method Detail

onPositionVisited

public void onPositionVisited(int position)
This method must be called in the getView method of your adapter.

Parameters:
position - The current position within the adapter.

setMemCacheRange

public void setMemCacheRange(int range)
Adjust the number of positions ahead that become cached in both the disk and memory caches.

Parameters:
range -

setDiskCacheRange

public void setDiskCacheRange(int range)
Adjust the number of positions ahead of those that become cached in memory that will be cached on disk.

Parameters:
range -