Class DynamicViewPager2Fragment
java.lang.Object
androidx.fragment.app.Fragment
com.pranavpandey.android.dynamic.support.fragment.DynamicFragment
com.pranavpandey.android.dynamic.support.fragment.DynamicViewPager2Fragment
- All Implemented Interfaces:
ComponentCallbacks
,SharedPreferences.OnSharedPreferenceChangeListener
,View.OnCreateContextMenuListener
,ActivityResultCaller
,MenuProvider
,HasDefaultViewModelProviderFactory
,LifecycleOwner
,ViewModelStoreOwner
,androidx.savedstate.SavedStateRegistryOwner
,DynamicLifecycle
,DynamicSearchListener
,DynamicTransitionListener
,DynamicViewPagerCallback
,DynamicProductFlavor
public abstract class DynamicViewPager2Fragment
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class androidx.fragment.app.Fragment
Fragment.InstantiationException, Fragment.SavedState
-
Field Summary
Modifier and TypeFieldDescriptionstatic String
Fragment argument key to set the initial view pager page.Fields inherited from class androidx.fragment.app.Fragment
mPreviousWho
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the currently selected view pager page or position.Get the tab layout used by this fragment.Get the view pager used by this fragment.void
onAddActivityHeader
(View view) This method will be called after adding the activity header.onCreateView
(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) void
onViewCreated
(View view, Bundle savedInstanceState) void
setPage
(int page) Set the current page or position for the view pager.Methods inherited from class com.pranavpandey.android.dynamic.support.fragment.DynamicFragment
finishActivity, getBooleanFromArguments, getCheckedMenuItemId, getDynamicActivity, getDynamicEnterTransition, getDynamicExitTransition, getDynamicReenterTransition, getDynamicReturnTransition, getHostMenu, getIntFromArguments, getNavigationViewId, getParcelableFromArguments, getPostponeTransitionView, getProductFlavor, getSavedInstanceState, getStringFromArguments, getStringFromArguments, getSubtitle, getSystemActivity, getTextWatcher, getTitle, invalidateHostMenu, isAppCompatActivity, isEnableMenu, isForceMenuIcons, isHasMenuProvider, isOnSharedPreferenceChangeListener, isSearchViewExpanded, isSearchViewListenerListener, isSupportActionBar, onAddMenuProvider, onAdjustEnterReturnTransition, onAdjustExitReenterTransition, onApplyTransitions, onCreate, onCreateMenu, onDestroy, onDynamicPause, onDynamicResume, onFindView, onMenuClosed, onMenuItemSelected, onPause, onPrepareMenu, onRemoveProvider, onResume, onSaveInstanceState, onSearchViewCollapsed, onSearchViewExpanded, onSharedPreferenceChanged, onStart, onStartActivityException, postponeEnterTransition, setHasOptionsMenu, setHostMenuItemVisible, setMenuVisibility, setResult, setResult, setResult, setResult, startActivity, startActivity, startActivityForResult, startActivityForResult, startMotionActivity, startMotionActivityForResult, startPostponedEnterTransition
Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getDefaultViewModelCreationExtras, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroyOptionsMenu, onDestroyView, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onStop, onViewStateRestored, postponeEnterTransition, registerForActivityResult, registerForActivityResult, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startIntentSenderForResult, toString, unregisterForContextMenu
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.pranavpandey.android.dynamic.support.listener.DynamicViewPagerCallback
createFragment, getItemCount, getTitle
-
Field Details
-
ADS_ARGS_VIEW_PAGER_PAGE
Fragment argument key to set the initial view pager page.
-
-
Constructor Details
-
DynamicViewPager2Fragment
public DynamicViewPager2Fragment()
-
-
Method Details
-
onCreateView
@Nullable public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) - Overrides:
onCreateView
in classFragment
-
onViewCreated
- Overrides:
onViewCreated
in classDynamicFragment
-
onAddActivityHeader
Description copied from class:DynamicFragment
This method will be called after adding the activity header.- Overrides:
onAddActivityHeader
in classDynamicFragment
- Parameters:
view
- The view added to the header.
-
getTabLayout
Get the tab layout used by this fragment.- Returns:
- The tab layout used by this fragment.
-
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.
-