-
- All Implemented Interfaces:
-
android.content.ComponentCallbacks,android.view.View.OnCreateContextMenuListener,androidx.activity.result.ActivityResultCaller,androidx.lifecycle.HasDefaultViewModelProviderFactory,androidx.lifecycle.LifecycleOwner,androidx.lifecycle.ViewModelStoreOwner,androidx.savedstate.SavedStateRegistryOwner
public abstract class PLYFlowBottomSheetFragment extends Fragment
Abstract base fragment for bottom sheet presentations (MODAL and DRAWER transitions). Provides common functionality for scrim handling, bottom sheet behavior, and presentation loading.
Subclasses must define:
defaultHeightRatio: The default height when no explicit height is provided
isDismissible: Whether the bottom sheet can be dismissed by user gestures
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description PLYFlowBottomSheetFragment()
-
Method Summary
Modifier and Type Method Description final ViewgetScrimView()Scrim view that dims the background when the bottom sheet is displayed. final UnitsetScrimView(View scrimView)Scrim view that dims the background when the bottom sheet is displayed. abstract BooleangetIsDismissible()Whether the bottom sheet should be dismissible via user gestures. LifecyclegetLifecycle()ViewModelStoregetViewModelStore()ViewModelProvider.FactorygetDefaultViewModelProviderFactory()CreationExtrasgetDefaultViewModelCreationExtras()final SavedStateRegistrygetSavedStateRegistry()UnitonStop()Since the view takes ~400ms to fully destroy due to the exit animation, we clear the ViewModel as soon as the fragment stops to prevent memory leaks and stale listeners. AnimationonCreateAnimation(Integer transit, Boolean enter, Integer nextAnim)Overrides the fragment exit animation to prevent the scrim from sliding down with the bottom sheet. ViewonCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)UnitonViewCreated(View view, Bundle savedInstanceState)-
Methods inherited from class io.purchasely.views.flows.fragments.PLYFlowBottomSheetFragment
callStartTransitionListener, createFragmentContainer, dump, equals, findFragmentByWho, generateActivityResultKey, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getAnimatingAway, getArguments, getChildFragmentManager, getContext, getEnterAnim, getEnterTransition, getEnterTransitionCallback, getExitAnim, getExitTransition, getExitTransitionCallback, getFocusedView, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLoaderManager, getNextTransition, getParentFragment, getParentFragmentManager, getPopDirection, getPopEnterAnim, getPopExitAnim, getPostOnViewCreatedAlpha, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getSharedElementSourceNames, getSharedElementTargetNames, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, hasOptionsMenu, hashCode, initState, isAdded, isDetached, isHidden, isInBackStack, isInLayout, isMenuVisible, isPostponed, isRemoving, isResumed, isStateSaved, isVisible, noteStateNotSaved, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDestroyView, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onResume, onSaveInstanceState, onStart, onViewStateRestored, performActivityCreated, performAttach, performConfigurationChanged, performContextItemSelected, performCreate, performCreateOptionsMenu, performCreateView, performDestroy, performDestroyView, performDetach, performGetLayoutInflater, performLowMemory, performMultiWindowModeChanged, performOptionsItemSelected, performOptionsMenuClosed, performPause, performPictureInPictureModeChanged, performPrepareOptionsMenu, performPrimaryNavigationFragmentChanged, performResume, performSaveInstanceState, performStart, performStop, performViewCreated, postponeEnterTransition, postponeEnterTransition, registerForActivityResult, registerForActivityResult, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, restoreChildFragmentState, restoreViewState, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setAnimations, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setFocusedView, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setNextTransition, setPopDirection, setPostOnViewCreatedAlpha, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementNames, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getScrimView
final View getScrimView()
Scrim view that dims the background when the bottom sheet is displayed.
-
setScrimView
final Unit setScrimView(View scrimView)
Scrim view that dims the background when the bottom sheet is displayed.
-
getIsDismissible
abstract Boolean getIsDismissible()
Whether the bottom sheet should be dismissible via user gestures. When true, users can swipe down or use the back button to dismiss.
-
getLifecycle
@NonNull() Lifecycle getLifecycle()
-
getViewModelStore
@NonNull() ViewModelStore getViewModelStore()
-
getDefaultViewModelProviderFactory
@NonNull() ViewModelProvider.Factory getDefaultViewModelProviderFactory()
-
getDefaultViewModelCreationExtras
@NonNull()@CallSuper() CreationExtras getDefaultViewModelCreationExtras()
-
getSavedStateRegistry
@NonNull() final SavedStateRegistry getSavedStateRegistry()
-
onStop
Unit onStop()
Since the view takes ~400ms to fully destroy due to the exit animation, we clear the ViewModel as soon as the fragment stops to prevent memory leaks and stale listeners.
This keeps io.purchasely.views.presentation.PLYPresentationViewController.listeners consistent, especially when users navigate back and forth quickly between steps.
-
onCreateAnimation
Animation onCreateAnimation(Integer transit, Boolean enter, Integer nextAnim)
Overrides the fragment exit animation to prevent the scrim from sliding down with the bottom sheet. Instead, the scrim fades out independently while the bottom sheet container slides down.
-
onCreateView
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
-
onViewCreated
Unit onViewCreated(View view, Bundle savedInstanceState)
-
-
-
-