Class DynamicRecyclerViewBinder<VH extends RecyclerView.ViewHolder>
java.lang.Object
com.pranavpandey.android.dynamic.support.recyclerview.binder.DynamicRecyclerViewBinder<VH>
- Type Parameters:
VH
- The type of the dynamic recycler view binder.
- Direct Known Subclasses:
DynamicDataBinder
A data binder class to bind data with the view inside the
DynamicBinderAdapter
.
Extend this class to implement your own data binding logic.
-
Constructor Summary
ConstructorDescriptionDynamicRecyclerViewBinder
(DynamicBinderAdapter binderAdapter) Constructor to initialize an object of this class. -
Method Summary
Modifier and TypeMethodDescriptionGet the recycler view adapter associated with this data binder.abstract int
Returns the total no.Get the recycler view adapter associated with this data binder.final void
Notify adapter when the data has been changed in this data binder.final void
notifyBinderItemChanged
(int position) Notify adapter when an item has been changed in this data binder.final void
notifyBinderItemInserted
(int position) Notify adapter when an item has been inserted in this data binder.final void
notifyBinderItemMoved
(int fromPosition, int toPosition) Notify adapter when an item has been moved in this data binder.final void
notifyBinderItemRangeChanged
(int position, int itemCount) Notify adapter when the item range of this data binder has been changed.final void
notifyBinderItemRangeInserted
(int position, int itemCount) Notify adapter when a set of items have been inserted in this data binder.final void
notifyBinderItemRangeRemoved
(int position, int itemCount) Notify adapter when a set of items have been removed in this data binder.final void
notifyBinderItemRemoved
(int position) Notify adapter when an item has been removed in this data binder.final void
Notify adapter when the data has been changed.abstract void
onBindViewHolder
(VH holder, int position) BindRecyclerView.ViewHolder
at a particular position.abstract VH
onCreateViewHolder
(ViewGroup parent, int viewType) Get theRecyclerView.ViewHolder
for this data binder.
-
Constructor Details
-
Method Details
-
onCreateViewHolder
Get theRecyclerView.ViewHolder
for this data binder.- Parameters:
parent
- The parent for this view holder.viewType
- The type of the view to create the view holder.- Returns:
- The view holder associated with this data binder.
-
onBindViewHolder
BindRecyclerView.ViewHolder
at a particular position.- Parameters:
holder
- The view holder for the recycler view.position
- The position to bind the view holder.
-
getRecyclerViewAdapter
Get the recycler view adapter associated with this data binder.- Returns:
- The recycler view adapter associated with this data binder.
-
getBinderAdapter
Get the recycler view adapter associated with this data binder.- Returns:
- The recycler view adapter associated with this data binder.
-
getItemCount
public abstract int getItemCount()Returns the total no. of items in this data binder.- Returns:
- The total no. of items in this data binder.
-
notifyDataSetChanged
public final void notifyDataSetChanged()Notify adapter when the data has been changed. -
notifyBinderItemChanged
public final void notifyBinderItemChanged(int position) Notify adapter when an item has been changed in this data binder.- Parameters:
position
- The position at which the item has been changed.
-
notifyBinderDataSetChanged
public final void notifyBinderDataSetChanged()Notify adapter when the data has been changed in this data binder. -
notifyBinderItemInserted
public final void notifyBinderItemInserted(int position) Notify adapter when an item has been inserted in this data binder.- Parameters:
position
- The position at which the item has been inserted.
-
notifyBinderItemMoved
public final void notifyBinderItemMoved(int fromPosition, int toPosition) Notify adapter when an item has been moved in this data binder.- Parameters:
fromPosition
- Initial position of the moved item.toPosition
- Final position of the moved item.
-
notifyBinderItemRemoved
public final void notifyBinderItemRemoved(int position) Notify adapter when an item has been removed in this data binder.- Parameters:
position
- The position at which the item has been removed.
-
notifyBinderItemRangeChanged
public final void notifyBinderItemRangeChanged(int position, int itemCount) Notify adapter when the item range of this data binder has been changed.- Parameters:
position
- The position at which the first item has been changed.itemCount
- Total no. of items have been changed.
-
notifyBinderItemRangeInserted
public final void notifyBinderItemRangeInserted(int position, int itemCount) Notify adapter when a set of items have been inserted in this data binder.- Parameters:
position
- The position at which the first item has been inserted.itemCount
- Total no. of items have been inserted.
-
notifyBinderItemRangeRemoved
public final void notifyBinderItemRangeRemoved(int position, int itemCount) Notify adapter when a set of items have been removed in this data binder.- Parameters:
position
- The position at which the first item has been removed.itemCount
- Total no. of items have been removed.
-