-
- All Implemented Interfaces:
-
android.view.View.OnClickListener,android.view.View.OnLongClickListener
public abstract class BindingGridViewAdapter<T extends Object> extends ClickableGridViewAdapter<T, BindingViewHolder>
BindingGridViewAdapter
-
-
Constructor Summary
Constructors Constructor Description BindingGridViewAdapter()
-
Method Summary
Modifier and Type Method Description abstract IntegergetLayoutRes()get layout resource BindingViewHolderonCreateViewHolder(ViewGroup parent, Integer viewType)Called when RecyclerView needs a new RecyclerView. UnitonBindViewHolder(BindingViewHolder holder, Integer position, Integer pagePosition, T item)Called by RecyclerView to display the data at the specified position. UnitconfigureViewHolder(BindingViewHolder holder)configure ViewHolder abstract UnitsetVariable(ViewDataBinding binding, T item, Integer position)Set variable dataexample: binding.setVariable(BR. -
Methods inherited from class com.kevin.gridpager.extras.binding.BindingGridViewAdapter
clickable, longClickable, onClick, onItemClick, onItemLongClick, onLongClick -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getLayoutRes
@LayoutRes() abstract Integer getLayoutRes()
get layout resource
-
onCreateViewHolder
BindingViewHolder onCreateViewHolder(ViewGroup parent, Integer viewType)
Called when RecyclerView needs a new RecyclerView.ViewHolder of the given type to represent an item.
- Parameters:
parent- The ViewGroup into which the new View will be added after it is bound to an adapter position.viewType- The view type of the new View.
-
onBindViewHolder
Unit onBindViewHolder(BindingViewHolder holder, Integer position, Integer pagePosition, T item)
Called by RecyclerView to display the data at the specified position. This method should update the contents of the RecyclerView.ViewHolder.itemView to reflect the item at the given position.
- Parameters:
holder- The ViewHolder which should be updated to represent the contents of the item at the given position in the data set.position- The position of the item within the adapter's data set.pagePosition- The position of the item within the page`s data set.item- The data of current position.
-
configureViewHolder
Unit configureViewHolder(BindingViewHolder holder)
configure ViewHolder
-
setVariable
abstract Unit setVariable(ViewDataBinding binding, T item, Integer position)
Set variable data
example: binding.setVariable(BR.viewModel, viewModel);
-
-
-
-