uk.co.ribot.easyadapter
Class EasyAdapter<T>

java.lang.Object
  extended by BaseAdapter
      extended by uk.co.ribot.easyadapter.EasyAdapter<T>

public class EasyAdapter<T>
extends BaseAdapter

Extension of BaseAdapter. Don't worry about implementing your own Adapter, the EasyAdapter will do the tedious work for you. You just have to implement an ItemViewHolder and pass it into the constructor of this class.

It implements the "view holder" design pattern so your ListView will scroll smoothly.


Constructor Summary
EasyAdapter(Context context, Class itemViewHolderClass)
          Constructs and EasyAdapter with a Context and an ItemViewHolder class.
EasyAdapter(Context context, Class itemViewHolderClass, List<T> listItems)
          Constructs and EasyAdapter with a Context, an ItemViewHolder class, and list of items.
 
Method Summary
 void addItem(T item)
          Adds a single item to the Adapter
 void addItems(List<T> listItems)
          Appends a list of items to the ones already in the Adapter
 int getCount()
           
 T getItem(int position)
           
 long getItemId(int position)
           
 View getView(int position, View convertView, ViewGroup parent)
           
 void setItems(List<T> listItems)
          Sets a new list of items into the Adapter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EasyAdapter

public EasyAdapter(Context context,
                   Class itemViewHolderClass,
                   List<T> listItems)
Constructs and EasyAdapter with a Context, an ItemViewHolder class, and list of items.

Parameters:
context - a valid Context
itemViewHolderClass - your ItemViewHolder implementation class
listItems - the list of items to load in the Adapter

EasyAdapter

public EasyAdapter(Context context,
                   Class itemViewHolderClass)
Constructs and EasyAdapter with a Context and an ItemViewHolder class.

Parameters:
context - a valid Context
itemViewHolderClass - your ItemViewHolder implementation class
Method Detail

setItems

public void setItems(List<T> listItems)
Sets a new list of items into the Adapter

Parameters:
listItems - new list of items

addItem

public void addItem(T item)
Adds a single item to the Adapter

Parameters:
item - item to add

addItems

public void addItems(List<T> listItems)
Appends a list of items to the ones already in the Adapter

Parameters:
listItems - list of items to append

getCount

public int getCount()

getItemId

public long getItemId(int position)

getItem

public T getItem(int position)

getView

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