-
- All Implemented Interfaces:
-
android.content.ComponentCallbacks,android.content.DialogInterface.OnCancelListener,android.content.DialogInterface.OnDismissListener,android.view.View.OnCreateContextMenuListener,androidx.activity.result.ActivityResultCaller,androidx.lifecycle.HasDefaultViewModelProviderFactory,androidx.lifecycle.LifecycleOwner,androidx.lifecycle.ViewModelStoreOwner,androidx.savedstate.SavedStateRegistryOwner
public abstract class Sheet extends SheetFragment
This class is the base of all types of sheets. You can implement this class in your own and build your own custom sheet with the already existing features which the base class offers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classSheet.Companion
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Sheet()
-
Method Summary
Modifier and Type Method Description StringgetDialogTag()ContextgetWindowContext()UnitsetWindowContext(Context windowContext)final UnittopStyle(TopStyle topStyle)Set the top style. final UnitnegativeButtonStyle(ButtonStyle negativeButtonStyle)Set the negative button style. final UnitpositiveButtonStyle(ButtonStyle positiveButtonStyle)Set the positive button style. final UnitnegativeButtonColorRes(@ColorRes() Integer negativeButtonColor)Set the negative button color. final UnitpositiveButtonColorRes(@ColorRes() Integer positiveButtonColor)Set the positive button color. final UnitnegativeButtonColor(@ColorInt() Integer negativeButtonColor)Set the negative button color. final UnitpositiveButtonColor(@ColorInt() Integer positiveButtonColor)Set the positive button color. final UnitwithCoverImage(Image image)Set a cover image. final UnitcloseIconButton(IconButton iconButton)Set the Close Button Drawable. final UnitdisplayNegativeButton(Boolean displayNegativeButton)Display the negative button. final UnitdisplayPositiveButton(Boolean displayPositiveButton)Display the positive button. final UnitdisplayToolbar(Boolean displayToolbar)Display the toolbar. final UnitdisplayCloseButton(Boolean displayCloseButton)Display the close button left of the title. final UnitdisplayHandle(Boolean displayHandle)Display the handle. final Unittitle(String title)Set the title of the sheet. final Unittitle(@StringRes() Integer titleRes)Set the title of the sheet. final Unittitle(@StringRes() Integer titleRes, Object formatArgs)Set the title of the sheet. final UnittitleColorRes(@ColorRes() Integer titleColorRes)Set the title color of the sheet. final UnittitleColor(@ColorInt() Integer titleColor)Set the title color of the sheet. final UnitonNegative(Function0<Unit> negativeListener)Set a listener. final UnitonNegative(@StringRes() Integer negativeRes, Function0<Unit> negativeListener)Set the text of the negative button and optionally a listener. final UnitonNegative(String negativeText, Function0<Unit> negativeListener)Set the text of the negative button and optionally a listener. final UnitonNegative(@StringRes() Integer negativeRes, @DrawableRes() Integer drawableRes, Function0<Unit> negativeListener)Set the text and drawable of the negative button and optionally a listener. final UnitonNegative(String negativeText, @DrawableRes() Integer drawableRes, Function0<Unit> negativeListener)Set the text and drawable of the negative button and optionally a listener. final UnitonDismiss(Function0<Unit> dismissListener)Set a listener that is invoked when the sheet is dismissed (after negative or positive button click). final UnitonCancel(Function0<Unit> cancelListener)Set a listener that is invoked when the sheet is cancelled. UnitonCancel(DialogInterface dialog)final UnitonClose(Function0<Unit> closeListener)Set a listener that is invoked when the sheet is closed. final UnitcustomLayoutHeight(Integer customLayoutHeight)Set the height of the custom sheet layout. Unitdismiss()final UnitwithIconButton(IconButton iconButton, Function0<Unit> listener)Add an icon button to the sheet toolbar to the right of the title. final TopStylegetTopStyle()final UnituseCover(Boolean useCover)final <T extends Any> TgetCoverAnimationView()final UnitsetCoverAnimationView(Object coverAnimationView)final UnitaddOnCreateViewListener(Function1<SheetsBaseBinding, Unit> onCreateViewListeners)final UnitremoveOnCreateViewListener(Function1<SheetsBaseBinding, Unit> onCreateViewListener)final UnitaddAddOnComponent(Function1<Sheet, Unit> addOnComponent)final UnitremoveAddOnComponent(Function1<Sheet, Unit> addOnComponent)ViewonCreateView(LayoutInflater inflater, ViewGroup container, Bundle saved)Create view of base sheet. abstract ViewonCreateLayoutView()Create custom view to be added to the base sheet. UnitonViewCreated(View view, Bundle savedInstanceState)final UnitsetupCoverSource(ImageSource imageSource, AppCompatImageView imageView)Setup an image source for the cover view. -
Methods inherited from class com.maxkeppeler.sheets.core.SheetFragment
createFragmentContainer, dismissAllowingStateLoss, getDialog, getShowsDialog, isCancelable, onAttach, onCreate, onDestroyView, onDetach, onDismiss, onFindViewById, onGetLayoutInflater, onHasView, onSaveInstanceState, onStop, onViewStateRestored, performCreateView, requireDialog, setCancelable, setShowsDialog, show, show, showNow -
Methods inherited from class com.maxkeppeler.sheets.core.Sheet
behavior, borderColor, borderWidth, borderWidth, cancelableOutside, cornerFamily, cornerRadius, cornerRadius, draggable, getActualCornerFamily, getActualCornerRadius, getTheme, navigationBarColor, navigationBarColorRes, onCreateDialog, onResume, onStart, peekHeight, setStyle, setupDialog, show, style -
Methods inherited from class androidx.fragment.app.DialogFragment
callStartTransitionListener, dump, equals, findFragmentByWho, generateActivityResultKey, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getAnimatingAway, getAnimator, getArguments, getChildFragmentManager, getContext, getDefaultViewModelProviderFactory, getEnterAnim, getEnterTransition, getEnterTransitionCallback, getExitAnim, getExitTransition, getExitTransitionCallback, getFocusedView, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getNextTransition, getParentFragment, getParentFragmentManager, getPopDirection, getPopEnterAnim, getPopExitAnim, getPostOnViewCreatedAlpha, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getSharedElementSourceNames, getSharedElementTargetNames, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hasOptionsMenu, hashCode, initState, isAdded, isDetached, isHidden, isHideReplaced, isInBackStack, isInLayout, isMenuVisible, isPostponed, isRemoving, isRemovingParent, isResumed, isStateSaved, isVisible, noteStateNotSaved, onActivityCreated, onActivityResult, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, performActivityCreated, performAttach, performConfigurationChanged, performContextItemSelected, performCreate, performCreateOptionsMenu, 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, setAnimatingAway, setAnimations, setAnimator, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setFocusedView, setHasOptionsMenu, setHideReplaced, setInitialSavedState, setMenuVisibility, setNextTransition, setOnStartEnterTransitionListener, 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
-
getDialogTag
String getDialogTag()
-
getWindowContext
Context getWindowContext()
-
setWindowContext
Unit setWindowContext(Context windowContext)
-
negativeButtonStyle
final Unit negativeButtonStyle(ButtonStyle negativeButtonStyle)
Set the negative button style.
-
positiveButtonStyle
final Unit positiveButtonStyle(ButtonStyle positiveButtonStyle)
Set the positive button style.
-
negativeButtonColorRes
final Unit negativeButtonColorRes(@ColorRes() Integer negativeButtonColor)
Set the negative button color.
-
positiveButtonColorRes
final Unit positiveButtonColorRes(@ColorRes() Integer positiveButtonColor)
Set the positive button color.
-
negativeButtonColor
final Unit negativeButtonColor(@ColorInt() Integer negativeButtonColor)
Set the negative button color.
-
positiveButtonColor
final Unit positiveButtonColor(@ColorInt() Integer positiveButtonColor)
Set the positive button color.
-
withCoverImage
final Unit withCoverImage(Image image)
Set a cover image.
-
closeIconButton
final Unit closeIconButton(IconButton iconButton)
Set the Close Button Drawable.
-
displayNegativeButton
final Unit displayNegativeButton(Boolean displayNegativeButton)
Display the negative button.
-
displayPositiveButton
final Unit displayPositiveButton(Boolean displayPositiveButton)
Display the positive button.
-
displayToolbar
final Unit displayToolbar(Boolean displayToolbar)
Display the toolbar. The toolbar consists of the close icon button, the title, the divider and the optional icon buttons. Overrides the style default.
-
displayCloseButton
final Unit displayCloseButton(Boolean displayCloseButton)
Display the close button left of the title. Overrides the style default.
-
displayHandle
final Unit displayHandle(Boolean displayHandle)
Display the handle. Overrides the style default.
-
title
final Unit title(String title)
Set the title of the sheet.
- Parameters:
title- The text for the title.
-
title
final Unit title(@StringRes() Integer titleRes)
Set the title of the sheet.
- Parameters:
titleRes- The String resource id for the title.
-
title
final Unit title(@StringRes() Integer titleRes, Object formatArgs)
Set the title of the sheet.
- Parameters:
titleRes- Resource id for the format stringformatArgs- The format arguments that will be used for substitution.
-
titleColorRes
final Unit titleColorRes(@ColorRes() Integer titleColorRes)
Set the title color of the sheet.
- Parameters:
titleColorRes- Color res for the title.
-
titleColor
final Unit titleColor(@ColorInt() Integer titleColor)
Set the title color of the sheet.
- Parameters:
titleColor- Color for the title.
-
onNegative
final Unit onNegative(Function0<Unit> negativeListener)
Set a listener.
- Parameters:
negativeListener- Listener that is invoked when the negative button is clicked.
-
onNegative
final Unit onNegative(@StringRes() Integer negativeRes, Function0<Unit> negativeListener)
Set the text of the negative button and optionally a listener.
- Parameters:
negativeRes- The String resource id for the negative button.negativeListener- Listener that is invoked when the negative button is clicked.
-
onNegative
final Unit onNegative(String negativeText, Function0<Unit> negativeListener)
Set the text of the negative button and optionally a listener.
- Parameters:
negativeText- The text for the negative button.negativeListener- Listener that is invoked when the negative button is clicked.
-
onNegative
final Unit onNegative(@StringRes() Integer negativeRes, @DrawableRes() Integer drawableRes, Function0<Unit> negativeListener)
Set the text and drawable of the negative button and optionally a listener.
- Parameters:
negativeRes- The String resource id for the negative button.drawableRes- The drawable resource for the button icon.negativeListener- Listener that is invoked when the negative button is clicked.
-
onNegative
final Unit onNegative(String negativeText, @DrawableRes() Integer drawableRes, Function0<Unit> negativeListener)
Set the text and drawable of the negative button and optionally a listener.
- Parameters:
negativeText- The text for the negative button.drawableRes- The drawable resource for the button icon.negativeListener- Listener that is invoked when the negative button is clicked.
-
onDismiss
final Unit onDismiss(Function0<Unit> dismissListener)
Set a listener that is invoked when the sheet is dismissed (after negative or positive button click).
-
onCancel
final Unit onCancel(Function0<Unit> cancelListener)
Set a listener that is invoked when the sheet is cancelled.
-
onCancel
Unit onCancel(DialogInterface dialog)
-
onClose
final Unit onClose(Function0<Unit> closeListener)
Set a listener that is invoked when the sheet is closed.
-
customLayoutHeight
final Unit customLayoutHeight(Integer customLayoutHeight)
Set the height of the custom sheet layout.
-
withIconButton
final Unit withIconButton(IconButton iconButton, Function0<Unit> listener)
Add an icon button to the sheet toolbar to the right of the title. The icon buttons will be aligned from the right in the order you call this method. You can only add up to 3 icon buttons.
-
getTopStyle
final TopStyle getTopStyle()
-
getCoverAnimationView
final <T extends Any> T getCoverAnimationView()
-
setCoverAnimationView
final Unit setCoverAnimationView(Object coverAnimationView)
-
addOnCreateViewListener
final Unit addOnCreateViewListener(Function1<SheetsBaseBinding, Unit> onCreateViewListeners)
-
removeOnCreateViewListener
final Unit removeOnCreateViewListener(Function1<SheetsBaseBinding, Unit> onCreateViewListener)
-
addAddOnComponent
final Unit addAddOnComponent(Function1<Sheet, Unit> addOnComponent)
-
removeAddOnComponent
final Unit removeAddOnComponent(Function1<Sheet, Unit> addOnComponent)
-
onCreateView
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle saved)
Create view of base sheet.
-
onCreateLayoutView
abstract View onCreateLayoutView()
Create custom view to be added to the base sheet.
-
onViewCreated
Unit onViewCreated(View view, Bundle savedInstanceState)
-
setupCoverSource
final Unit setupCoverSource(ImageSource imageSource, AppCompatImageView imageView)
Setup an image source for the cover view.
-
-
-
-