Class DynamicRecyclerViewAdapter<VH extends RecyclerView.ViewHolder>
java.lang.Object
androidx.recyclerview.widget.RecyclerView.Adapter<VH>
com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdapter<VH>
- Type Parameters:
VH
- The type of the recycler view holder.
- Direct Known Subclasses:
DynamicBinderAdapter
,DynamicPresetsAdapter
public abstract class DynamicRecyclerViewAdapter<VH extends RecyclerView.ViewHolder>
extends RecyclerView.Adapter<VH>
A
RecyclerView.Adapter
to display items in different sections.
Each section can have a section header also.
Extend this adapter and implement DynamicRecyclerViewAdapter.DynamicRecyclerViewItem
interface
in the object class.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Implement this interface in the object class to get item type and section header text.static @interface
Valid item types for this adapter. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Constant for the type empty view.static final int
Constant for the type item.static final int
Constant for the type section divider.static final int
Constant for the type section header.static final int
Constant for the type item setting.static final int
Constant for the type unknown. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the context associated with the recycler view.Returns the layout associated with the recycler view.Get the recycler view displaying this adapter.boolean
Checks whether the recycler view associated with this adapter is computing layout.void
onAttachedToRecyclerView
(RecyclerView recyclerView) Methods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
bindViewHolder, createViewHolder, getItemCount, getItemId, getItemViewType, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onBindViewHolder, onBindViewHolder, onCreateViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled, registerAdapterDataObserver, setHasStableIds, unregisterAdapterDataObserver
-
Field Details
-
TYPE_UNKNOWN
public static final int TYPE_UNKNOWNConstant for the type unknown.- See Also:
-
TYPE_EMPTY_VIEW
public static final int TYPE_EMPTY_VIEWConstant for the type empty view.- See Also:
-
TYPE_SECTION_HEADER
public static final int TYPE_SECTION_HEADERConstant for the type section header.- See Also:
-
TYPE_ITEM
public static final int TYPE_ITEMConstant for the type item.- See Also:
-
TYPE_SETTING
public static final int TYPE_SETTINGConstant for the type item setting.- See Also:
-
TYPE_SECTION_DIVIDER
public static final int TYPE_SECTION_DIVIDERConstant for the type section divider.- See Also:
-
-
Constructor Details
-
DynamicRecyclerViewAdapter
public DynamicRecyclerViewAdapter()
-
-
Method Details
-
onAttachedToRecyclerView
- Overrides:
onAttachedToRecyclerView
in classRecyclerView.Adapter<VH extends RecyclerView.ViewHolder>
-
isComputingLayout
public boolean isComputingLayout()Checks whether the recycler view associated with this adapter is computing layout.- Returns:
true
if the recycler view is computing layout.
-
getRecyclerView
Get the recycler view displaying this adapter.- Returns:
- The recycler view displaying this adapter.
-
getContext
Returns the context associated with the recycler view.- Returns:
- The context associated with the recycler view.
-
getLayoutManager
Returns the layout associated with the recycler view.- Returns:
- The layout associated with the recycler view.
-