|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.xtremelabs.imageutils.AbstractImageLoader
public abstract class AbstractImageLoader
Nested Class Summary | |
---|---|
static class |
AbstractImageLoader.Options
This class provides all the options that can be set when making loadImage calls. |
Field Summary | |
---|---|
static java.lang.String |
TAG
|
Method Summary | |
---|---|
void |
clearMemCache()
Forces the memory cache to release all references to bitmaps. |
void |
destroy()
When implementing the ImageLoader in an Activity , this method MUST BE CALLED from the Activity's onDestroy method. |
static void |
invalidateFileSystemUri(Context applicationContext,
java.lang.String uri)
This method will remove all information regarding this image from the cache. |
void |
loadImage(ImageView imageView,
java.lang.String uri)
Loads the image located at the provided URI into the provided ImageView .If the URI is referring to a location on the web, the image will be cached both on disk and in memory. |
void |
loadImage(ImageView imageView,
java.lang.String uri,
AbstractImageLoader.Options options)
This call is identical to loadImage(ImageView, String) , only it allows the developer to provide custom options for the request. |
void |
loadImage(ImageView imageView,
java.lang.String uri,
AbstractImageLoader.Options options,
ImageLoaderListener listener)
Loads the image located at the provided URI. |
void |
loadImageFromResource(ImageView imageView,
int resourceId)
This method will load the selected resource into the ImageView and cancel any previous requests that have been made to the ImageView . |
void |
precacheImageToDisk(java.lang.String uri)
Caches the image at the provided URI into the disk cache. |
static void |
precacheImageToDisk(java.lang.String uri,
Context applicationContext)
Caches the image at the provided URI into the disk cache. |
void |
precacheImageToDiskAndMemory(java.lang.String uri,
Context applicationContext,
java.lang.Integer width,
java.lang.Integer height)
Deprecated. |
void |
precacheImageToDiskAndMemory(java.lang.String uri,
Dimensions bounds,
AbstractImageLoader.Options options)
This method must be called from the UI thread. Caches the image at the provided URL into both the disk cache and into the memory cache. This method call is useful for pre-caching smaller images. |
void |
setDefaultOptions(AbstractImageLoader.Options options)
The ImageLoader will default to the options provided here if no other options are provided. |
void |
setMaximumDiskCacheSize(long maxSizeInBytes)
Sets the maximum disk cache size. |
void |
setMaximumMemCacheSize(long maxSizeInBytes)
Sets the maximum size of the memory cache in bytes. WARNING: Setting the memory cache size value too high will result in OutOfMemory exceptions. |
static void |
setNetworkRequestCreator(Context appContext,
NetworkRequestCreator networkRequestCreator)
Allows the usage of custom network libraries. |
boolean |
stopLoadingImage(ImageView imageView)
This call prevents any previous loadImage call from loading a Bitmap into the provided ImageView. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TAG
Method Detail |
---|
public void destroy()
ImageLoader
in an Activity
, this method MUST BE CALLED from the Activity's onDestroy method.
When implementing the ImageLoader
in a Fragment
, this method MUST BE CALLED from the Fragment's onDestroyView method.
ThreadChecker.CalledFromWrongThreadException
- This is thrown if the method is called from off the UI thread.public void setDefaultOptions(AbstractImageLoader.Options options)
options
- If set to null, the ImageLoader will automatically select the system's default options set.public static void setNetworkRequestCreator(Context appContext, NetworkRequestCreator networkRequestCreator)
NetworkRequestCreator
is provided to the image system, all network calls will go through that interface.
appContext
- networkRequestCreator
- public void loadImage(ImageView imageView, java.lang.String uri)
ImageView
.
imageView
- The bitmap will automatically be loaded to this view.uri
- Location of the image. The URI can refer to an image located either on the local file system or on the web (URL).public void loadImage(ImageView imageView, java.lang.String uri, AbstractImageLoader.Options options)
loadImage(ImageView, String)
, only it allows the developer to provide custom options for the request. See AbstractImageLoader.Options
.
imageView
- The bitmap will automatically be loaded to this view.uri
- Location of the image. The URI can refer to an image located either on the local file system or on the web (URL).options
- If options is set to null, the ImageLoader
will use the default options. The default options can be modified by calling setDefaultOptions(Options)
. See the AbstractImageLoader.Options
docs for
additional details.public void loadImage(ImageView imageView, java.lang.String uri, AbstractImageLoader.Options options, ImageLoaderListener listener)
ImageView
. Instead, the ImageLoaderListener
will have its onImageAvailable() method called on the UI thread with a reference to both the
ImageView
and the bitmap. It is up to the developer to load the bitmap to the view.
imageView
- The view that will be displaying the image. The bitmap will not be loaded directly into this view. Rather, a reference to the bitmap and to the ImageView will be passed back to the
ImageLoaderListener
.uri
- Location of the image. The URI can refer to an image located either on the local file system or on the web (URL).options
- If options is set to null, the ImageLoader
will use the default options. The default options can be modified by calling setDefaultOptions(Options)
. See the AbstractImageLoader.Options
docs for
additional details.listener
- This listener will be called once the image request is complete. If the bitmap was retrieved successfully, the
ImageLoaderListener#onImageAvailable(ImageView, android.graphics.Bitmap, ImageReturnedFrom)
method will be called.public void loadImageFromResource(ImageView imageView, int resourceId)
ImageView
and cancel any previous requests that have been made to the ImageView
.
imageView
- resourceId
- public boolean stopLoadingImage(ImageView imageView)
imageView
- public static void invalidateFileSystemUri(Context applicationContext, java.lang.String uri)
uri
- The file system URI to remove.public void clearMemCache()
ImageView
and the ImageView is still being
referenced.
public void setMaximumMemCacheSize(long maxSizeInBytes)
maxSizeInBytes
- public void setMaximumDiskCacheSize(long maxSizeInBytes)
maxSizeInBytes
- public void precacheImageToDisk(java.lang.String uri)
uri
- applicationContext
- public static void precacheImageToDisk(java.lang.String uri, Context applicationContext)
uri
- applicationContext
- public void precacheImageToDiskAndMemory(java.lang.String uri, Dimensions bounds, AbstractImageLoader.Options options)
uri
- bounds
- The expected dimensions of the view in pixels. The width and/or height can be set to null.options
- The options used to customize how the view gets precached. Please note that all options relating the image bounds are ignored during this precaching call. The "bounds" object is used instead. Otherwise,
the options should be identical to the image request that will be performed by the app.
ThreadChecker.CalledFromWrongThreadException
- This is thrown if the method is called from off the UI thread.@Deprecated public void precacheImageToDiskAndMemory(java.lang.String uri, Context applicationContext, java.lang.Integer width, java.lang.Integer height)
#precacheImageToDiskAndMemory(String, Integer, Integer)
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |