public interface

ListUrlImageAdapter

implements Adapter
com.droidux.pack.list.adapters.ListUrlImageAdapter

Class Overview

Extended Adapter to be implemented when the underlying data need to download images from URLs. When used with widgets that supports it, such as the DuxListView, this adapter allows efficient tasks/threads management for downloading images from the internet.

See Also

Summary

Nested Classes
interface ListUrlImageAdapter.Request A Request object is used to add image url to the queue for download from the web. 
[Expand]
Inherited Constants
From interface android.widget.Adapter
Public Methods
abstract void downloadUrlImages(int position, View itemView, ListUrlImageAdapter.Request request)
Download images from URLs.
abstract void onImageFail(int position, View itemView, String url, int refId, Exception exception)
When there's an error when downloading the image or transforming the remote image to a Bitmap, this callback will be called.
abstract void onImageReady(int position, View itemView, String url, int refId, Bitmap bitmap)
Callback when the image is successfully downloaded and transformed to a Bitmap.
abstract void onWaitingForImage(int position, View itemView, String url, int refId)
Callback when the image has to be downloaded from the web, or from the cache that will take relatively long time to fetch (e.g.
[Expand]
Inherited Methods
From interface android.widget.Adapter

Public Methods

public abstract void downloadUrlImages (int position, View itemView, ListUrlImageAdapter.Request request)

Since: API Level 2.5

Download images from URLs. Use the given ListUrlImageAdapter.Request object to add the image url(s) to the download queue. The actual download will be done and managed internally by the widgets that support this adapter, such as the DuxListView.

Parameters
position The position of the data in the adapter
itemView The item view for the position. This is the same as returned by the getView(int, android.view.View, android.view.ViewGroup).
request Use it to add the image url to the download queue.

public abstract void onImageFail (int position, View itemView, String url, int refId, Exception exception)

Since: API Level 2.5

When there's an error when downloading the image or transforming the remote image to a Bitmap, this callback will be called.

Parameters
position The position of the data in the adapter.
itemView The item view representing the data in the adapter for the specified position. This is the same view returned by getView(int, android.view.View, android.view.ViewGroup)
url The url of the image
refId The reference id of the image, as specified when using com.droidux.widget.adapters.UrlImageAdapter.Request#download(String, int). Default is 0.
exception The exception that occurred when downloading the requested image.

public abstract void onImageReady (int position, View itemView, String url, int refId, Bitmap bitmap)

Since: API Level 2.5

Callback when the image is successfully downloaded and transformed to a Bitmap.

Parameters
position The position of the data in the adapter.
itemView The item view representing the data in the adapter for the specified position. This is the same view returned by getView(int, android.view.View, android.view.ViewGroup)
url The url of the image
refId The reference id of the image, as specified when using com.droidux.widget.adapters.UrlImageAdapter.Request#download(String, int). Default is 0.
bitmap The downloaded image.

public abstract void onWaitingForImage (int position, View itemView, String url, int refId)

Since: API Level 2.5

Callback when the image has to be downloaded from the web, or from the cache that will take relatively long time to fetch (e.g. disk cache).

Parameters
position The position of the data in the adapter.
itemView The item view representing the data in the adapter for the specified position. This is the same view returned by getView(int, android.view.View, android.view.ViewGroup)
url The url of the image
refId The reference id of the image, as specified when using com.droidux.widget.adapters.UrlImageAdapter.Request#download(String, int). Default is 0.