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.

  • Field Details

    • TYPE_UNKNOWN

      public static final int TYPE_UNKNOWN
      Constant for the type unknown.
      See Also:
    • TYPE_EMPTY_VIEW

      public static final int TYPE_EMPTY_VIEW
      Constant for the type empty view.
      See Also:
    • TYPE_SECTION_HEADER

      public static final int TYPE_SECTION_HEADER
      Constant for the type section header.
      See Also:
    • TYPE_ITEM

      public static final int TYPE_ITEM
      Constant for the type item.
      See Also:
    • TYPE_SETTING

      public static final int TYPE_SETTING
      Constant for the type item setting.
      See Also:
    • TYPE_SECTION_DIVIDER

      public static final int TYPE_SECTION_DIVIDER
      Constant for the type section divider.
      See Also:
  • Constructor Details

    • DynamicRecyclerViewAdapter

      public DynamicRecyclerViewAdapter()
  • Method Details

    • onAttachedToRecyclerView

      public void onAttachedToRecyclerView(@Nullable RecyclerView recyclerView)
      Overrides:
      onAttachedToRecyclerView in class RecyclerView.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

      @Nullable public RecyclerView getRecyclerView()
      Get the recycler view displaying this adapter.
      Returns:
      The recycler view displaying this adapter.
    • getContext

      @Nullable public Context getContext()
      Returns the context associated with the recycler view.
      Returns:
      The context associated with the recycler view.
    • getLayoutManager

      @Nullable public RecyclerView.LayoutManager getLayoutManager()
      Returns the layout associated with the recycler view.
      Returns:
      The layout associated with the recycler view.