Class DynamicViewPagerFragment

java.lang.Object
androidx.fragment.app.Fragment
com.pranavpandey.android.dynamic.support.fragment.DynamicFragment
com.pranavpandey.android.dynamic.support.fragment.DynamicViewPagerFragment
All Implemented Interfaces:
ComponentCallbacks, SharedPreferences.OnSharedPreferenceChangeListener, View.OnCreateContextMenuListener, ActivityResultCaller, MenuProvider, HasDefaultViewModelProviderFactory, LifecycleOwner, ViewModelStoreOwner, androidx.savedstate.SavedStateRegistryOwner, DynamicLifecycle, DynamicSearchListener, DynamicTransitionListener, DynamicViewPagerCallback, DynamicProductFlavor

public abstract class DynamicViewPagerFragment extends DynamicFragment implements DynamicViewPagerCallback
An abstract ViewPager fragment to display multiple fragments inside the view pager along with the tabs.

Extend this fragment and implement the necessary methods to use it inside an activity.

  • Field Details

    • ADS_ARGS_VIEW_PAGER_PAGE

      public static String ADS_ARGS_VIEW_PAGER_PAGE
      Fragment argument key to set the initial view pager page.
  • Constructor Details

    • DynamicViewPagerFragment

      public DynamicViewPagerFragment()
  • Method Details

    • onCreateView

      @Nullable public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
      Overrides:
      onCreateView in class Fragment
    • onViewCreated

      public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)
      Overrides:
      onViewCreated in class DynamicFragment
    • onAddActivityHeader

      public void onAddActivityHeader(@Nullable View view)
      Description copied from class: DynamicFragment
      This method will be called after adding the activity header.
      Overrides:
      onAddActivityHeader in class DynamicFragment
      Parameters:
      view - The view added to the header.
    • getTabLayout

      @Nullable public TabLayout getTabLayout()
      Get the tab layout used by this fragment.
      Returns:
      The tab layout used by this fragment.
    • getViewPager

      @Nullable public ViewPager getViewPager()
      Get the view pager used by this fragment.
      Returns:
      The view pager used by this fragment.
    • getCurrentPage

      public int getCurrentPage()
      Returns the currently selected view pager page or position.
      Returns:
      The currently selected view pager page or position.
    • setPage

      public void setPage(int page)
      Set the current page or position for the view pager.
      Parameters:
      page - The current position for the view pager.