SideSheetDialog

public class SideSheetDialog


Base class for android.app.Dialogs styled as a side sheet.

For more information, see the component developer guidance and design guidelines.

Summary

Public constructors

SideSheetDialog(Context context)
SideSheetDialog(Context context, int theme)

Public methods

void

This function can be called from a few different use cases, including swiping the dialog away or calling `dismiss()` from a `SideSheetDialogFragment`, tapping outside a dialog, etc...

SideSheetBehavior<View>

Returns the behavior associated with this SideSheetDialog.

boolean

Returns whether dismissing will perform the swipe away animation on the sheet, rather than the window animation for the dialog.

void
void
void
setCancelable(boolean cancelable)
void
setCanceledOnTouchOutside(boolean cancel)
void
setContentView(int layoutResId)
void
setContentView(View view)
void
setContentView(View view, LayoutParams params)
void
setDismissWithSheetAnimationEnabled(boolean dismissWithAnimation)

Set whether to perform the swipe away animation on the sheet when dismissing, rather than the window animation for the dialog.

void
setSheetEdge(int gravity)

Set the edge which the sheet should originate from.

Protected methods

void
onCreate(Bundle savedInstanceState)
void

Public constructors

SideSheetDialog

public SideSheetDialog(Context context)

SideSheetDialog

public SideSheetDialog(Context context, int theme)

Public methods

cancel

public void cancel()

This function can be called from a few different use cases, including swiping the dialog away or calling `dismiss()` from a `SideSheetDialogFragment`, tapping outside a dialog, etc...

The default animation to dismiss this dialog is a fade-out transition through a windowAnimation. Set setDismissWithSheetAnimationEnabled to true if you want to utilize the sheet animation instead.

If this function is called from a swipe interaction, or dismissWithAnimation is false, then keep the default behavior.

getBehavior

public SideSheetBehavior<View> getBehavior()

Returns the behavior associated with this SideSheetDialog. The behavior must always be a SideSheetBehavior; otherwise, this method will throw an .

isDismissWithSheetAnimationEnabled

public boolean isDismissWithSheetAnimationEnabled()

Returns whether dismissing will perform the swipe away animation on the sheet, rather than the window animation for the dialog.

onAttachedToWindow

public void onAttachedToWindow()

onDetachedFromWindow

public void onDetachedFromWindow()

setCancelable

public void setCancelable(boolean cancelable)

setCanceledOnTouchOutside

public void setCanceledOnTouchOutside(boolean cancel)

setContentView

public void setContentView(int layoutResId)

setContentView

public void setContentView(View view)

setContentView

public void setContentView(View view, LayoutParams params)

setDismissWithSheetAnimationEnabled

public void setDismissWithSheetAnimationEnabled(boolean dismissWithAnimation)

Set whether to perform the swipe away animation on the sheet when dismissing, rather than the window animation for the dialog.

Parameters
boolean dismissWithAnimation

True if swipe away animation should be used when dismissing.

setSheetEdge

public void setSheetEdge(int gravity)

Set the edge which the sheet should originate from.

Note: This method should be called when the sheet is initialized, before it is shown. Runtime sheet edge changes are not supported.

Parameters
int gravity

the edge from which the sheet and its animations should originate.

Throws
java.lang.IllegalStateException

if the sheet is null or has already been laid out

Protected methods

onCreate

protected void onCreate(Bundle savedInstanceState)

onStart

protected void onStart()