Class DynamicBinderAdapter<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>
- Type Parameters:
- VB- The type of the dynamic recycler view binder.
- Direct Known Subclasses:
- DynamicSimpleBinderAdapter,- DynamicTypeBinderAdapter
public abstract class DynamicBinderAdapter<VB extends DynamicRecyclerViewBinder>
extends DynamicRecyclerViewAdapter<RecyclerView.ViewHolder>
A 
RecyclerView.Adapter to display different types of items or views in a recycler view.
 Each section can have a header or a completely different item.
Extend this adapter and use DynamicRecyclerViewBinder to create binding logic
 for the each type of views.
- 
Nested Class SummaryNested classes/interfaces inherited from class com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdapterDynamicRecyclerViewAdapter.DynamicRecyclerViewItem, DynamicRecyclerViewAdapter.ItemType
- 
Field SummaryFields inherited from class com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdapterTYPE_EMPTY_VIEW, TYPE_ITEM, TYPE_SECTION_DIVIDER, TYPE_SECTION_HEADER, TYPE_SETTING, TYPE_UNKNOWN
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract intgetBinderPosition(int position) Get the position of a data binder inside the recycler view.abstract VBgetDataBinder(int viewType) Get data binder according to the view type.abstract intabstract intgetItemViewType(int position) abstract intgetPosition(VB binder, int position) Get the position of a data binder item inside the recycler view.voidThis method will be called when the data has been changed.voidnotifyBinderItemChanged(VB binder, int position) This method will be called when an item has been changed in the data binder.voidnotifyBinderItemInserted(VB binder, int position) This method will be called when an item has been inserted in the data binder.voidnotifyBinderItemMoved(VB binder, int fromPosition, int toPosition) This method will be called when an item has been moved in the data binder.abstract voidnotifyBinderItemRangeChanged(VB binder, int position, int itemCount) This method will be called when the item range of a data binder has been changed.abstract voidnotifyBinderItemRangeInserted(VB binder, int position, int itemCount) This method will be called when a set of items have been inserted in a data binder.abstract voidnotifyBinderItemRangeRemoved(VB binder, int position, int itemCount) This method will be called when a set of items have been removed in a data binder.voidnotifyBinderItemRemoved(VB binder, int position) This method will be called when an item has been removed in the data binder.voidonBindViewHolder(RecyclerView.ViewHolder holder, int position) onCreateViewHolder(ViewGroup parent, int viewType) Methods inherited from class com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdaptergetContext, getLayoutManager, getRecyclerView, isComputingLayout, onAttachedToRecyclerViewMethods inherited from class androidx.recyclerview.widget.RecyclerView.AdapterbindViewHolder, 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- 
DynamicBinderAdapterpublic DynamicBinderAdapter()
 
- 
- 
Method Details- 
onCreateViewHolder- Specified by:
- onCreateViewHolderin class- RecyclerView.Adapter<RecyclerView.ViewHolder>
 
- 
onBindViewHolder- Specified by:
- onBindViewHolderin class- RecyclerView.Adapter<RecyclerView.ViewHolder>
 
- 
getItemCountpublic abstract int getItemCount()- Specified by:
- getItemCountin class- RecyclerView.Adapter<RecyclerView.ViewHolder>
 
- 
getItemViewTypepublic abstract int getItemViewType(int position) - Overrides:
- getItemViewTypein class- RecyclerView.Adapter<RecyclerView.ViewHolder>
 
- 
getDataBinderGet data binder according to the view type.- Parameters:
- viewType- The view type constant to get the data binder.
- Returns:
- The data binder associated with this view type.
- See Also:
 
- 
getPositionGet the position of a data binder item inside the recycler view.- 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.
 
- 
getBinderPositionpublic abstract int getBinderPosition(int position) Get the position of a data binder inside the recycler view.- Parameters:
- position- The position of the data binder.
- Returns:
- The position of the data binder inside the recycler view.
 
- 
notifyBinderDataSetChangedpublic void notifyBinderDataSetChanged()This method will be called when the data has been changed.
- 
notifyBinderItemChangedThis method will be called when an item has been changed in the data binder.- Parameters:
- binder- The data binder inside the recycler view.
- position- The position at which the item has been changed.
 
- 
notifyBinderItemInsertedThis method will be called when an item has been inserted in the data binder.- Parameters:
- binder- The data binder inside the recycler view.
- position- The position at which the item is inserted.
 
- 
notifyBinderItemRemovedThis method will be called when an item has been removed in the data binder.- Parameters:
- binder- The data binder inside the recycler view.
- position- The position at which the item has been removed.
 
- 
notifyBinderItemMovedThis method will be called when an item has been moved in the data binder.- Parameters:
- binder- The data binder inside the recycler view.
- fromPosition- Initial position of the moved item.
- toPosition- Final position of the moved item.
 
- 
notifyBinderItemRangeChangedThis method will be called when the item range of a data binder has been changed.- 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.
 
- 
notifyBinderItemRangeInsertedThis method will be called when a set of items have been inserted in a data binder.- 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.
 
- 
notifyBinderItemRangeRemovedThis method will be called when a set of items have been removed in a data binder.- 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.
 
 
-