|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.github.ignition.support.images.remote.RemoteImageLoader
public class RemoteImageLoader
Realizes a background image loader that downloads an image from a URL, optionally backed by a two-level FIFO cache. If the image to be loaded is present in the cache, it is set immediately on the given view. Otherwise, a thread from a thread pool will be used to download the image in the background and set the image on the view as soon as it completes.
Constructor Summary | |
---|---|
RemoteImageLoader(android.content.Context context)
|
|
RemoteImageLoader(android.content.Context context,
boolean createCache)
Creates a new ImageLoader that is backed by an ImageCache . |
Method Summary | |
---|---|
void |
clearImageCache()
Clears the image cache, if it's used. |
ImageCache |
getImageCache()
Returns the image cache backing this image loader. |
void |
loadImage(String imageUrl,
android.widget.ImageView imageView)
Triggers the image loader for the given image and view. |
void |
loadImage(String imageUrl,
android.widget.ImageView imageView,
android.graphics.drawable.Drawable dummyDrawable)
Triggers the image loader for the given image and view. |
void |
loadImage(String imageUrl,
android.widget.ImageView imageView,
android.graphics.drawable.Drawable dummyDrawable,
RemoteImageLoaderHandler handler)
Triggers the image loader for the given image and view. |
void |
loadImage(String imageUrl,
android.widget.ImageView imageView,
RemoteImageLoaderHandler handler)
Triggers the image loader for the given image and view. |
void |
setDefaultBufferSize(int defaultBufferSize)
If the server you're loading images from does not report file sizes via the Content-Length header, then you can use this method to tell the downloader how much space it should allocate by default when downloading an image into memory. |
void |
setDownloadFailedDrawable(android.graphics.drawable.Drawable drawable)
|
void |
setDownloadInProgressDrawable(android.graphics.drawable.Drawable drawable)
|
void |
setImageCache(ImageCache imageCache)
|
void |
setMaxDownloadAttempts(int numAttempts)
|
void |
setThreadPoolSize(int numThreads)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RemoteImageLoader(android.content.Context context)
public RemoteImageLoader(android.content.Context context, boolean createCache)
ImageCache
. The cache will by default
cache to the device's external storage, and expire images after 1 day. You can set useCache
to false and then supply your own image cache instance via setImageCache(ImageCache)
, or fine-tune the default one through getImageCache()
.
context
- the current contextcreateCache
- whether to create a default ImageCache
used for cachingMethod Detail |
---|
public void setThreadPoolSize(int numThreads)
numThreads
- the maximum number of threads that will be started to download images in parallelpublic void setMaxDownloadAttempts(int numAttempts)
numAttempts
- how often the image loader should retry the image download if network connection
failspublic void setDefaultBufferSize(int defaultBufferSize)
defaultBufferSize
- how big the buffer should be into which the image file is read. This should be big
enough to hold the largest image you expect to downloadpublic void setDownloadInProgressDrawable(android.graphics.drawable.Drawable drawable)
public void setDownloadFailedDrawable(android.graphics.drawable.Drawable drawable)
public void setImageCache(ImageCache imageCache)
public void clearImageCache()
Application.onLowMemory()
.
public ImageCache getImageCache()
ImageCache
public void loadImage(String imageUrl, android.widget.ImageView imageView)
RemoteImageLoaderHandler
to process the bitmap after downloading it.
imageUrl
- the URL of the image to downloadimageView
- the ImageView which should be updated with the new imagepublic void loadImage(String imageUrl, android.widget.ImageView imageView, android.graphics.drawable.Drawable dummyDrawable)
RemoteImageLoaderHandler
to process the bitmap after downloading it.
imageUrl
- the URL of the image to downloadimageView
- the ImageView which should be updated with the new imagedummyDrawable
- the Drawable to be shown while the image is being downloaded.public void loadImage(String imageUrl, android.widget.ImageView imageView, RemoteImageLoaderHandler handler)
imageUrl
- the URL of the image to downloadimageView
- the ImageView which should be updated with the new imagehandler
- the handler that will process the bitmap after completionpublic void loadImage(String imageUrl, android.widget.ImageView imageView, android.graphics.drawable.Drawable dummyDrawable, RemoteImageLoaderHandler handler)
imageUrl
- the URL of the image to downloadimageView
- the ImageView which should be updated with the new imagedummyDrawable
- the Drawable to be shown while the image is being downloaded.handler
- the handler that will process the bitmap after completion
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |