Class NavigationCollectionAdapter

  • All Implemented Interfaces:
    androidx.viewpager2.adapter.StatefulAdapter

    public class NavigationCollectionAdapter
    extends androidx.viewpager2.adapter.FragmentStateAdapter
    NavigationCollectionAdapter is the adapter for the navigation collection that handles the fragments for each tab in the bottom navigation bar
    • Constructor Summary

      Constructors 
      Constructor Description
      NavigationCollectionAdapter​(androidx.fragment.app.FragmentActivity fa)
      Constructor for the NavigationCollectionAdapter
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      androidx.fragment.app.Fragment createFragment​(int position)
      createFragment creates a new fragment for the tab at the given position
      int getItemCount()
      getItemCount returns the number of tabs in the bottom navigation bar
      • Methods inherited from class androidx.viewpager2.adapter.FragmentStateAdapter

        containsItem, getItemId, onAttachedToRecyclerView, onBindViewHolder, onCreateViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewRecycled, restoreState, saveState, setHasStableIds
      • Methods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter

        bindViewHolder, createViewHolder, getItemViewType, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onBindViewHolder, onViewDetachedFromWindow, registerAdapterDataObserver, unregisterAdapterDataObserver
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NavigationCollectionAdapter

        public NavigationCollectionAdapter​(androidx.fragment.app.FragmentActivity fa)
        Constructor for the NavigationCollectionAdapter
        Parameters:
        fa - the FragmentActivity that contains the NavigationCollectionAdapter
    • Method Detail

      • createFragment

        @NonNull
        public androidx.fragment.app.Fragment createFragment​(int position)
        createFragment creates a new fragment for the tab at the given position
        Specified by:
        createFragment in class androidx.viewpager2.adapter.FragmentStateAdapter
        Parameters:
        position - the position of the tab
        Returns:
        the fragment for the tab at the given position
      • getItemCount

        public int getItemCount()
        getItemCount returns the number of tabs in the bottom navigation bar
        Specified by:
        getItemCount in class androidx.recyclerview.widget.RecyclerView.Adapter<androidx.viewpager2.adapter.FragmentViewHolder>
        Returns:
        the number of tabs in the bottom navigation bar