ComponentDialog


open class ComponentDialog : Dialog, LifecycleOwner, OnBackPressedDispatcherOwner, NavigationEventDispatcherOwner, SavedStateRegistryOwner

Known direct subclasses
AppCompatDialog

Base class for AppCompat themed android.app.Dialogs.

Known indirect subclasses
AlertDialog

A subclass of Dialog that can display one, two or three buttons.

MediaRouteChooserDialog

This class implements the route chooser dialog for MediaRouter.

MediaRouteControllerDialog

This class implements the route controller dialog for MediaRouter.


Base class for dialogs that enables composition of higher level components.

Summary

Public constructors

ComponentDialog(context: Context, themeResId: @StyleRes Int)

Public functions

open Unit
open Unit

Sets the view tree owners before setting the content view so that the inflation process and attach listeners will see them already present.

open Unit
open Bundle
open Unit
setContentView(layoutResID: Int)
open Unit
open Unit

Protected functions

open Unit
@CallSuper
onCreate(savedInstanceState: Bundle?)
open Unit
open Unit

Public properties

open Lifecycle
open NavigationEventDispatcher

Lazily provides a NavigationEventDispatcher for back navigation handling, including support for predictive back gestures introduced in Android 13 (API 33+).

final OnBackPressedDispatcher

Retrieve the OnBackPressedDispatcher that will be triggered when onBackPressed is called.

open SavedStateRegistry

Inherited functions

From android.app.Dialog
open Unit
open Unit
open Unit
open Unit
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open T
<T : View> findViewById(p0: Int)
open ActionBar?
Context
open View?
open LayoutInflater
open OnBackInvokedDispatcher
Activity?
SearchEvent?
Int
open Window?
open Unit
open Unit
open Boolean
open Unit
open Unit
open Unit
open Unit
open Boolean
open Unit
open Unit
onCreateContextMenu(
    p0: ContextMenu,
    p1: View,
    p2: ContextMenu.ContextMenuInfo
)
open Boolean
open Boolean
open View?
open Unit
open Boolean
open Boolean
onKeyDown(p0: Int, p1: KeyEvent)
open Boolean
open Boolean
onKeyMultiple(p0: Int, p1: Int, p2: KeyEvent)
open Boolean
open Boolean
onKeyUp(p0: Int, p1: KeyEvent)
open Boolean
open Boolean
onMenuOpened(p0: Int, p1: Menu)
open Boolean
open Unit
open Unit
onPanelClosed(p0: Int, p1: Menu)
open Boolean
open Boolean
onPreparePanel(p0: Int, p1: View?, p2: Menu)
open Unit
open Boolean
open Boolean
open Boolean
open Boolean
open Unit
open Unit
open ActionMode?
open ActionMode?
open Unit
open Unit
open Unit
Boolean
T
<T : View> requireViewById(p0: Int)
open Unit
open Unit
open Unit
open Unit
Unit
Unit
Unit
Unit
open Unit
open Unit
open Unit
open Unit
Unit
open Unit
open Unit
Unit
open Unit
open Unit
open Unit
From android.view.Window.Callback

Public constructors

ComponentDialog

Added in 1.5.0
ComponentDialog(context: Context, themeResId: @StyleRes Int = 0)

Public functions

addContentView

open fun addContentView(view: View, params: ViewGroup.LayoutParams?): Unit

initializeViewTreeOwners

Added in 1.8.0
@CallSuper
open fun initializeViewTreeOwners(): Unit

Sets the view tree owners before setting the content view so that the inflation process and attach listeners will see them already present.

onBackPressed

Added in 1.6.0
@CallSuper
open fun onBackPressed(): Unit

onSaveInstanceState

open fun onSaveInstanceState(): Bundle

setContentView

open fun setContentView(layoutResID: Int): Unit

setContentView

open fun setContentView(view: View): Unit

setContentView

open fun setContentView(view: View, params: ViewGroup.LayoutParams?): Unit

Protected functions

onCreate

@CallSuper
protected open fun onCreate(savedInstanceState: Bundle?): Unit

onStart

@CallSuper
protected open fun onStart(): Unit

onStop

@CallSuper
protected open fun onStop(): Unit

Public properties

lifecycle

Added in 1.5.0
open val lifecycleLifecycle
open val navigationEventDispatcherNavigationEventDispatcher

Lazily provides a NavigationEventDispatcher for back navigation handling, including support for predictive back gestures introduced in Android 13 (API 33+).

This dispatcher acts as the central point for back navigation events. When a navigation event occurs (e.g., a back gesture), it safely invokes ComponentDialog.onBackPressed.

onBackPressedDispatcher

final val onBackPressedDispatcherOnBackPressedDispatcher

Retrieve the OnBackPressedDispatcher that will be triggered when onBackPressed is called.

Returns
OnBackPressedDispatcher

The OnBackPressedDispatcher associated with this ComponentDialog.

savedStateRegistry

Added in 1.7.0
open val savedStateRegistrySavedStateRegistry