T - The item type.public final class ItemBinding<T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
VAR_NONE
Use this constant as the variable id to not bind the item in the collection to the layout if
no data is need, like a static footer or loading indicator.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
bind(ViewDataBinding binding,
T item)
Binds the item and extra bindings to the given binding.
|
ItemBinding<T> |
bindExtra(int variableId,
java.lang.Object value)
Bind an extra variable to the view with the given variable id.
|
ItemBinding<T> |
clearExtras()
Clear all extra variables.
|
java.lang.Object |
extraBinding(int variableId)
Returns the current extra binding for the given variable id or null if one isn't present.
|
int |
layoutRes()
Returns the current layout fo this binding.
|
ItemBinding<T> |
layoutRes(int layoutRes)
Set the layout.
|
static <T> ItemBinding<T> |
of(int variableId,
int layoutRes)
Constructs an instance with the given variable id and layout.
|
static <T> ItemBinding<T> |
of(OnItemBind<T> onItemBind)
Constructs an instance with the given callback.
|
void |
onItemBind(int position,
T item)
Updates the state of the binding for the given item and position.
|
ItemBinding<T> |
removeExtra(int variableId)
Remove an extra variable with the given variable id.
|
ItemBinding<T> |
set(int variableId,
int layoutRes)
Set the variable id and layout.
|
int |
variableId()
Returns the current variable id of this binding.
|
ItemBinding<T> |
variableId(int variableId)
Set the variable id.
|
public static final int VAR_NONE
public static <T> ItemBinding<T> of(int variableId, int layoutRes)
public static <T> ItemBinding<T> of(OnItemBind<T> onItemBind)
OnItemBindpublic final ItemBinding<T> set(int variableId, int layoutRes)
OnItemBind.onItemBind(ItemBinding, int, Object).public final ItemBinding<T> variableId(int variableId)
OnItemBind.onItemBind(ItemBinding,
int, Object).public final ItemBinding<T> layoutRes(int layoutRes)
OnItemBind.onItemBind(ItemBinding, int,
Object).public final ItemBinding<T> bindExtra(int variableId, java.lang.Object value)
public final ItemBinding<T> clearExtras()
OnItemBind.onItemBind(ItemBinding, int, Object).public ItemBinding<T> removeExtra(int variableId)
OnItemBind.onItemBind(ItemBinding, int, Object).public final int variableId()
public final int layoutRes()
public final java.lang.Object extraBinding(int variableId)
public void onItemBind(int position,
T item)
public boolean bind(ViewDataBinding binding,
T item)
java.lang.IllegalStateException - if the variable id isn't present in the layout.