|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.co.ribot.easyadapter.ViewHolder
uk.co.ribot.easyadapter.ItemViewHolder<T>
public abstract class ItemViewHolder<T>
Easier alternative to implementing your own android.widget.BaseAdapter
. Extend this class as it's explained below and then use EasyAdapter
to link it to your android.widget.AdapterView
LayoutId
, i.e @LayoutId(R.id.item_layout). It will link the ItemViewHolder to the item's layout.ViewId
, i.e @ViewId(R.id.textView1). It will look for the viewId's in the item's layout and will assign the views to the annotated fields of the subclass.onSetValues(Object, PositionInfo)
and populate the views using the data in the item objectonSetListeners(Object, PositionInfo)
to add listeners to the views.
Constructor Summary | |
---|---|
ItemViewHolder(View view)
Constructs an item view holder with the item view |
|
ItemViewHolder(View view,
T item)
Constructs an item view holder with the item view and the item data |
Method Summary | |
---|---|
T |
getItem()
Gets the item data |
void |
onSetListeners(T item,
PositionInfo positionInfo)
Implement this method to add listeners to the views |
abstract void |
onSetValues(T item,
PositionInfo positionInfo)
Must implement this method to populate the views with the data in the item object. |
void |
setItem(T item)
Sets the item data |
Methods inherited from class uk.co.ribot.easyadapter.ViewHolder |
---|
getView |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ItemViewHolder(View view)
view
- the parent view where the held views reside.public ItemViewHolder(View view, T item)
view
- the parent view where the held views reside.item
- the data item that is used to populate the held views.Method Detail |
---|
public T getItem()
public void setItem(T item)
item
- the data item that is used to populate the held views.public abstract void onSetValues(T item, PositionInfo positionInfo)
item
- the data item that is used to populate the held views.positionInfo
- information about the position of the item on the list.public void onSetListeners(T item, PositionInfo positionInfo)
item
- the data item that is used to populate the held views.positionInfo
- information about the position of the item on the list.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |