public static class

GalleryFlowInterfaces.Adapters.AdapterLooper

extends BaseAdapter
implements GalleryUrlImageAdapter
java.lang.Object
   ↳ android.widget.BaseAdapter
     ↳ com.droidux.pack.gallery.interfaces.GalleryFlowInterfaces.Adapters.AdapterLooper
Known Direct Subclasses

Class Overview

AdapterLooper is a wrapper adapter to loop/cycle a SpinnerAdapter so that they appear to be an endless loop. It's not really endless, but the views will be cycled up to MAX_VALUE.

Summary

[Expand]
Inherited Constants
From interface android.widget.Adapter
Public Constructors
GalleryFlowInterfaces.Adapters.AdapterLooper(SpinnerAdapter innerAdapter)
Construct an adapter looper object.
Public Methods
void downloadUrlImages(int position, View itemView, GalleryUrlImageAdapter.Request request)
Download images from URLs.
int getCenterPosition()
Gets the position of the center item of the looper.
int getCount()
How many items are in the data set represented by this Adapter.
SpinnerAdapter getInnerAdapter()
Gets the wrapped adapter that is cycled by this looper.
int getInnerCount()
Gets the number of items in the wrapped adapter.
int getInnerPosition(int position)
Gets the actual position of an item in the wrapped adapter based on its position in the looper.
Object getItem(int position)
Get the data item associated with the specified position in the data set.
long getItemId(int position)
Get the row id associated with the specified position in the list.
int getItemViewType(int position)
Get the type of View that will be created by getView(int, View, ViewGroup) for the specified item.
View getView(int position, View convertView, ViewGroup parent)
Get a View that displays the data at the specified position in the data set.
int getViewTypeCount()

Returns the number of types of Views that will be created by getView(int, View, ViewGroup).

boolean isEmpty()
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.
void onImageReady(int position, View itemView, String url, int refId, Bitmap bitmap)
Callback when the image is successfully downloaded and transformed to a Bitmap.
void onWaitingForImage(int position, View itemView, String imageUrl, 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 class android.widget.BaseAdapter
From class java.lang.Object
From interface android.widget.Adapter
From interface android.widget.ListAdapter
From interface android.widget.SpinnerAdapter
From interface com.droidux.pack.gallery.adapters.GalleryUrlImageAdapter

Public Constructors

public GalleryFlowInterfaces.Adapters.AdapterLooper (SpinnerAdapter innerAdapter)

Since: API Level 2.5

Construct an adapter looper object.

Parameters
innerAdapter The wrapped adapter.

Public Methods

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

Since: API Level 2.5

Download images from URLs. Use the given GalleryUrlImageAdapter.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.

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 int getCenterPosition ()

Since: API Level 2.5

Gets the position of the center item of the looper.

Returns
  • The center position.

public int getCount ()

Since: API Level 2.5

How many items are in the data set represented by this Adapter.

Returns
  • Count of items.

public SpinnerAdapter getInnerAdapter ()

Since: API Level 2.5

Gets the wrapped adapter that is cycled by this looper.

Returns
  • The wrapped adapter.

public int getInnerCount ()

Since: API Level 2.5

Gets the number of items in the wrapped adapter.

Returns
  • Count of items.

public int getInnerPosition (int position)

Since: API Level 2.5

Gets the actual position of an item in the wrapped adapter based on its position in the looper.

Parameters
position The item's position in the looper.
Returns
  • The item's position in the wrapped adapter.

public Object getItem (int position)

Since: API Level 2.5

Get the data item associated with the specified position in the data set.

Parameters
position Position of the item whose data we want within the adapter's data set.
Returns
  • The data at the specified position.

public long getItemId (int position)

Since: API Level 2.5

Get the row id associated with the specified position in the list.

Parameters
position The position of the item within the adapter's data set whose row id we want.
Returns
  • The id of the item at the specified position.

public int getItemViewType (int position)

Since: API Level

Get the type of View that will be created by getView(int, View, ViewGroup) for the specified item.

Parameters
position The position of the item within the adapter's data set whose view type we want.
Returns

public View getView (int position, View convertView, ViewGroup parent)

Since: API Level 2.5

Get a View that displays the data at the specified position in the data set. You can either create a View manually or inflate it from an XML layout file. When the View is inflated, the parent View (GridView, ListView...) will apply default layout parameters unless you use inflate(int, android.view.ViewGroup, boolean) to specify a root view and to prevent attachment to the root.

Parameters
position The position of the item within the adapter's data set of the item whose view we want.
convertView The old view to reuse, if possible. Note: You should check that this view is non-null and of an appropriate type before using. If it is not possible to convert this view to display the correct data, this method can create a new view. Heterogeneous lists can specify their number of view types, so that this View is always of the right type (see getViewTypeCount() and getItemViewType(int)).
parent The parent that this view will eventually be attached to
Returns
  • A View corresponding to the data at the specified position.

public int getViewTypeCount ()

Since: API Level

Returns the number of types of Views that will be created by getView(int, View, ViewGroup). Each type represents a set of views that can be converted in getView(int, View, ViewGroup). If the adapter always returns the same type of View for all items, this method should return 1.

This method will only be called when when the adapter is set on the the AdapterView.

Returns
  • The number of types of Views that will be created by this adapter

public boolean isEmpty ()

Since: API Level

public 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 download(String, int). Default is 0.
exception The exception that occurred when downloading the requested image.

public 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 download(String, int). Default is 0.
bitmap The downloaded image.

public void onWaitingForImage (int position, View itemView, String imageUrl, 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)
imageUrl The url of the image
refId The reference id of the image, as specified when using download(String, int). Default is 0.