DeweyDialog

A dialog that displays a title, a description, and up to three buttons. The dialog can also display a custom view. The dialog can be shown and dismissed by calling show and dismiss.

This is intended to be used as a replacement for android.app.AlertDialog, for showing short messages and actions to the user.

Start by creating a Builder and setting the title, message, and buttons. Then call create to create the dialog, or show to create and show the dialog.

It supports overriding the ui mode to force light or dark mode. In those cases, A DayNight theme must be provided via mThemeResId to make it work. Since custom view layout requires certain attributes to be set in the theme, it is recommended to use the default app theme. For UiMode.AUTOMATIC, it's not necessary.

Types

Link copied to clipboard
class Builder(context: Context)

Builder for creating a DeweyDialog.

Link copied to clipboard

The layout of the buttons. The buttons can be laid out horizontally or vertically. The default layout is horizontal.

Link copied to clipboard

Used to change the style of buttons at the bottom of the dialog.

Link copied to clipboard
data class Params(val mContext: Context, var mTitle: CharSequence? = null, var mMessage: CharSequence? = null, var mButton1Listener: DeweyPopupInterface.OnClickListener? = null, var mButton2Listener: DeweyPopupInterface.OnClickListener? = null, var mButton3Listener: DeweyPopupInterface.OnClickListener? = null, var mOnDismissListener: DeweyPopupInterface.OnDismissListener? = null, var mOnShowListener: DeweyPopupInterface.OnShowListener? = null, var mWindowAccessibilityText: CharSequence? = null, var mCancelable: Boolean = true, var mCanceledOnTouchOutside: Boolean = true, var mButton1Text: CharSequence? = null, var mButton2Text: CharSequence? = null, var mButton3Text: CharSequence? = null, var mButton1Style: DeweyDialog.ButtonStyle = ButtonStyle.DEFAULT, var mButton2Style: DeweyDialog.ButtonStyle = ButtonStyle.DEFAULT, var mButton3Style: DeweyDialog.ButtonStyle = ButtonStyle.DEFAULT, var mButtonLayout: DeweyDialog.ButtonLayout = ButtonLayout.HORIZONTAL, @LayoutRes var mCustomViewLayoutResId: Int? = null, var mCustomView: View? = null, var mUiMode: DeweyDialog.UiMode = UiMode.AUTOMATIC, @StyleRes var mThemeResId: Int? = null)

Params for creating a DeweyDialog.

Link copied to clipboard

The UI mode.

Properties

Link copied to clipboard

Whether the popup is cancelable. If set to true, the popup can be dismissed by pressing the back button.

Link copied to clipboard

Whether the popup is canceled when the user touches outside of the popup.

Functions

Link copied to clipboard
open override fun dismiss()
Link copied to clipboard
fun getButton(whichButton: Int): Button

For testing purposes only

Link copied to clipboard

Get the layout inflater that considers the forced UI mode.

Link copied to clipboard
open override fun isShowing(): Boolean
Link copied to clipboard
fun onCreate()
Link copied to clipboard
fun onStart()
Link copied to clipboard
fun onStop()
Link copied to clipboard
Link copied to clipboard
open override fun setWindowFocusAccessibilityText(charSequence: CharSequence)

Set the accessibility text announced when the dialog is shown. This is used to provide context to the user when the dialog is shown.

Link copied to clipboard
open override fun show()