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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataBinder
(VB binder) Add data binder to display in this adapter.void
addDataBinders
(Collection<VB> binders) Add data binders to display in this adapter.final void
addDataBinders
(VB... binders) Add data binders to display in this adapter.Get the list of data binders displayed by this adapter.int
getBinderPosition
(int position) Get the position of a data binder inside the recycler view.getDataBinder
(int viewType) Get data binder according to the view type.int
int
getItemViewType
(int position) int
getPosition
(VB binder, int position) Get the position of a data binder item inside the recycler view.void
notifyBinderItemRangeChanged
(VB binder, int position, int itemCount) This method will be called when the item range of a data binder has been changed.void
notifyBinderItemRangeInserted
(VB binder, int position, int itemCount) This method will be called when a set of items have been inserted in a data binder.void
notifyBinderItemRangeRemoved
(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, onCreateViewHolder
Methods inherited from class com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdapter
getContext, getLayoutManager, getRecyclerView, isComputingLayout, onAttachedToRecyclerView
Methods 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:
getItemCount
in classDynamicBinderAdapter<VB extends DynamicRecyclerViewBinder<?>>
-
getItemViewType
public int getItemViewType(int position) - Specified by:
getItemViewType
in classDynamicBinderAdapter<VB extends DynamicRecyclerViewBinder<?>>
-
getDataBinder
Description copied from class:DynamicBinderAdapter
Get data binder according to the view type.- Specified by:
getDataBinder
in 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:DynamicBinderAdapter
Get the position of a data binder item inside the recycler view.- Specified by:
getPosition
in 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:DynamicBinderAdapter
Get the position of a data binder inside the recycler view.- Specified by:
getBinderPosition
in 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:DynamicBinderAdapter
This method will be called when the item range of a data binder has been changed.- Specified by:
notifyBinderItemRangeChanged
in 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:DynamicBinderAdapter
This method will be called when a set of items have been inserted in a data binder.- Specified by:
notifyBinderItemRangeInserted
in 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:DynamicBinderAdapter
This method will be called when a set of items have been removed in a data binder.- Specified by:
notifyBinderItemRangeRemoved
in 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.
-