Class DynamicSimpleBinderAdapter<VB extends DynamicRecyclerViewBinder<?>>
java.lang.Object
androidx.recyclerview.widget.RecyclerView.Adapter<VH>
com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdapter<RecyclerView.ViewHolder>
com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicBinderAdapter<VB>
com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicSimpleBinderAdapter<VB>
- Type Parameters:
VB- The type of the dynamic recycler view binder.
- Direct Known Subclasses:
DynamicItemsAdapter,SimpleDataBinderAdapter
public abstract class DynamicSimpleBinderAdapter<VB extends DynamicRecyclerViewBinder<?>>
extends DynamicBinderAdapter<VB>
A simple recycler view adapter to implement the
DynamicBinderAdapter
and DynamicRecyclerViewBinder.-
Nested Class Summary
Nested classes/interfaces inherited from class com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdapter
DynamicRecyclerViewAdapter.DynamicRecyclerViewItem, DynamicRecyclerViewAdapter.ItemType -
Field Summary
Fields inherited from class com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdapter
TYPE_EMPTY_VIEW, TYPE_ITEM, TYPE_SECTION_DIVIDER, TYPE_SECTION_HEADER, TYPE_SETTING, TYPE_UNKNOWN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDataBinder(VB binder) Add data binder to display in this adapter.voidaddDataBinders(Collection<VB> binders) Add data binders to display in this adapter.final voidaddDataBinders(VB... binders) Add data binders to display in this adapter.Get the list of data binders displayed by this adapter.intgetBinderPosition(int position) Get the position of a data binder inside the recycler view.getDataBinder(int viewType) Get data binder according to the view type.intintgetItemViewType(int position) intgetPosition(VB binder, int position) Get the position of a data binder item inside the recycler view.voidnotifyBinderItemRangeChanged(VB binder, int position, int itemCount) This method will be called when the item range of a data binder has been changed.voidnotifyBinderItemRangeInserted(VB binder, int position, int itemCount) This method will be called when a set of items have been inserted in a data binder.voidnotifyBinderItemRangeRemoved(VB binder, int position, int itemCount) This method will be called when a set of items have been removed in a data binder.Methods inherited from class com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicBinderAdapter
notifyBinderDataSetChanged, notifyBinderItemChanged, notifyBinderItemInserted, notifyBinderItemMoved, notifyBinderItemRemoved, onBindViewHolder, onCreateViewHolderMethods inherited from class com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdapter
getContext, getLayoutManager, getRecyclerView, isComputingLayout, onAttachedToRecyclerViewMethods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
bindViewHolder, createViewHolder, getItemId, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onBindViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled, registerAdapterDataObserver, setHasStableIds, unregisterAdapterDataObserver
-
Constructor Details
-
DynamicSimpleBinderAdapter
public DynamicSimpleBinderAdapter()
-
-
Method Details
-
getItemCount
public int getItemCount()- Specified by:
getItemCountin classDynamicBinderAdapter<VB extends DynamicRecyclerViewBinder<?>>
-
getItemViewType
public int getItemViewType(int position) - Specified by:
getItemViewTypein classDynamicBinderAdapter<VB extends DynamicRecyclerViewBinder<?>>
-
getDataBinder
Description copied from class:DynamicBinderAdapterGet data binder according to the view type.- Specified by:
getDataBinderin classDynamicBinderAdapter<VB extends DynamicRecyclerViewBinder<?>>- Parameters:
viewType- The view type constant to get the data binder.- Returns:
- The data binder associated with this view type.
- See Also:
-
getPosition
Description copied from class:DynamicBinderAdapterGet the position of a data binder item inside the recycler view.- Specified by:
getPositionin classDynamicBinderAdapter<VB extends DynamicRecyclerViewBinder<?>>- Parameters:
binder- The data binder inside the recycler view.position- The position of the data binder item.- Returns:
- The position of the data binder item inside the recycler view.
-
getBinderPosition
public int getBinderPosition(int position) Description copied from class:DynamicBinderAdapterGet the position of a data binder inside the recycler view.- Specified by:
getBinderPositionin classDynamicBinderAdapter<VB extends DynamicRecyclerViewBinder<?>>- Parameters:
position- The position of the data binder.- Returns:
- The position of the data binder inside the recycler view.
-
notifyBinderItemRangeChanged
Description copied from class:DynamicBinderAdapterThis method will be called when the item range of a data binder has been changed.- Specified by:
notifyBinderItemRangeChangedin classDynamicBinderAdapter<VB extends DynamicRecyclerViewBinder<?>>- Parameters:
binder- The data binder inside the recycler view.position- The position at which the first item has been changed.itemCount- Total no. of items have been changed.
-
notifyBinderItemRangeInserted
Description copied from class:DynamicBinderAdapterThis method will be called when a set of items have been inserted in a data binder.- Specified by:
notifyBinderItemRangeInsertedin classDynamicBinderAdapter<VB extends DynamicRecyclerViewBinder<?>>- Parameters:
binder- The data binder inside the recycler view.position- The position at which the first item has been inserted.itemCount- Total no. of items have been inserted.
-
notifyBinderItemRangeRemoved
Description copied from class:DynamicBinderAdapterThis method will be called when a set of items have been removed in a data binder.- Specified by:
notifyBinderItemRangeRemovedin classDynamicBinderAdapter<VB extends DynamicRecyclerViewBinder<?>>- Parameters:
binder- The data binder inside the recycler view.position- The position at which the first item has been removed.itemCount- Total no. of items have been removed.
-
getBinderList
Get the list of data binders displayed by this adapter.- Returns:
- The list of data binders displayed by this adapter.
-
addDataBinder
Add data binder to display in this adapter.- Parameters:
binder- The data binder to be added in this adapter
-
addDataBinders
Add data binders to display in this adapter.- Parameters:
binders- The array of dynamic data binders to be added in this adapter.
-
addDataBinders
Add data binders to display in this adapter.- Parameters:
binders- The array of dynamic data binders to be added in this adapter.
-