public class OnItemBindClass<T> extends java.lang.Object implements OnItemBind<T>
OnItemBind that selects an item view based on the class of the given item.
itemBind = new OnItemBindClass<>()
.map(String.class, BR.name, R.layout.item_name)
.map(Footer.class, ItemBinding.VAR_NONE, R.layout.item_footer);
| Constructor and Description |
|---|
OnItemBindClass() |
| Modifier and Type | Method and Description |
|---|---|
int |
itemTypeCount()
Returns the number of item types in the map.
|
OnItemBindClass<T> |
map(java.lang.Class<? extends T> itemClass,
int variableId,
int layoutRes)
Maps the given class to the given variableId and layout.
|
<E extends T> |
map(java.lang.Class<E> itemClass,
OnItemBind<E> onItemBind)
Maps the given class to the given
OnItemBind. |
void |
onItemBind(ItemBinding itemBinding,
int position,
T item)
Called on each item in the collection, allowing you to modify the given
ItemBinding. |
public OnItemBindClass<T> map(java.lang.Class<? extends T> itemClass, int variableId, int layoutRes)
public <E extends T> OnItemBindClass<T> map(java.lang.Class<E> itemClass, OnItemBind<E> onItemBind)
OnItemBind. This is assignment-compatible match with the object represented by Class.public int itemTypeCount()
BindingListViewAdapter.BindingListViewAdapter(int) or app:itemTypeCount in an AdapterView.public void onItemBind(ItemBinding itemBinding, int position, T item)
OnItemBindItemBinding.
Note that you should not do complex processing in this method as it's called many times.onItemBind in interface OnItemBind<T>