Fork me
BeyondAR
Augmented Reality Framework for Android
 All Classes Functions Variables
com.beyondar.android.util.cache.BitmapCache Class Reference

Classes

interface  OnExternalBitmapLoadedCacheListener
 

Public Member Functions

BitmapFactory.Options getOptimizedBitmapOption ()
 
BitmapCache newCache (String id, boolean alwaysPurge)
 
BitmapCache newCache (int cacheSize, String id, boolean alwaysPurge)
 
void clean ()
 Clean all the Bitmaps stored.
 
int cleanRecylcedBitmaps ()
 Clean the recycled Bitmaps stored in the cache. More...
 
void purge ()
 This method will clean the cache and will recycle all the bitmaps.
 
Bitmap storeBitmap (String uri, Bitmap btm)
 Store a bitmap with the name of the URI. More...
 
synchronized void removeBitmap (String uri)
 
int getImageState (String uri)
 
Bitmap getBitmap (int id)
 Get the image from the resources. More...
 
Bitmap getBitmap (String uri)
 Get the Bitmap according to the uri. More...
 
boolean isImageLoaded (String uri)
 
void addOnExternalBitmapLoadedCahceListener (OnExternalBitmapLoadedCacheListener listener)
 Add a listener for when a bitmap that is not stored locally needs to be loaded. More...
 
boolean removeOnExternalBitmapLoadedCacheListener (OnExternalBitmapLoadedCacheListener listener)
 Remove the listener. More...
 
Bitmap requestDownloadBitmap (String uri)
 

Static Public Member Functions

static BitmapCache initialize (Resources resources, String id, boolean alwaysPurge)
 
static BitmapCache initialize (Resources resources, int maxWidth, int maxHeight, String id, boolean alwaysPurge)
 
static BitmapCache initialize (Resources resources, int maxWidth, int maxHeight, int cacheSize, String id, boolean alwaysPurge)
 
static int calculateInSampleSize (BitmapFactory.Options options, int reqWidth, int reqHeight)
 
static String generateUri (int res)
 Generate the the String URI according to the res id. More...
 
static String normalizeURI (int res)
 Normalize the resource int to a valid URI for the BitmapCache. More...
 

Static Public Attributes

static final int IMAGE_NOT_LOADED = 0
 
static final int IMAGE_LOADED = 1
 
static final int IMAGE_IN_PROGRESS = 2
 
static final int ERROR_LOADING_IMAGE = 3
 
static final int DEFAULT_CACHE_SIZE = 6 * 1024 * 1024
 Default cache size. More...
 
static final int DEFAULT_TIME_OUT = 30000
 
static final int DEFAULT_MAX_WIDTH = 256
 
static final int DEFAULT_MAX_HEIGHT = 256
 
static final String HEADER_HTTP = "http://"
 
static final String HEADER_HTTPS = "https://"
 
static final String HEADER_FILE = "file://"
 
static final String HEADER_FILE_ = "/"
 
static final String HEADER_RESOURCE = "res://"
 
static final String HEADER_ASSETS = "assets://"
 

Member Function Documentation

void com.beyondar.android.util.cache.BitmapCache.addOnExternalBitmapLoadedCahceListener ( OnExternalBitmapLoadedCacheListener  listener)

Add a listener for when a bitmap that is not stored locally needs to be loaded.

Parameters
listener
int com.beyondar.android.util.cache.BitmapCache.cleanRecylcedBitmaps ( )

Clean the recycled Bitmaps stored in the cache.

Returns
Return the number of recycled imaged founded in the cache.
static String com.beyondar.android.util.cache.BitmapCache.generateUri ( int  res)
static

Generate the the String URI according to the res id.

Parameters
res
Returns
The String that represents the image

Here is the caller graph for this function:

Bitmap com.beyondar.android.util.cache.BitmapCache.getBitmap ( int  id)

Get the image from the resources.

Parameters
idThe resource id to load
Returns
The bitmap if the image is already loaded, null otherwise
Bitmap com.beyondar.android.util.cache.BitmapCache.getBitmap ( String  uri)

Get the Bitmap according to the uri.

If it is not loaded, it try to load first.

Parameters
uri
Returns
static String com.beyondar.android.util.cache.BitmapCache.normalizeURI ( int  res)
static

Normalize the resource int to a valid URI for the BitmapCache.

Parameters
res
Returns
The res as a normalized URI ready to be used.

Here is the caller graph for this function:

boolean com.beyondar.android.util.cache.BitmapCache.removeOnExternalBitmapLoadedCacheListener ( OnExternalBitmapLoadedCacheListener  listener)

Remove the listener.

Parameters
listener
Returns
Bitmap com.beyondar.android.util.cache.BitmapCache.storeBitmap ( String  uri,
Bitmap  btm 
)

Store a bitmap with the name of the URI.

Parameters
btm
uri
Returns
The bitmap stored

Member Data Documentation

final int com.beyondar.android.util.cache.BitmapCache.DEFAULT_CACHE_SIZE = 6 * 1024 * 1024
static

Default cache size.

6 MB


The documentation for this class was generated from the following file: