ModalViewModel

abstract class ModalViewModel<P : ModalPanel>(panel: P) : FrontendViewModel<P> , NavigablePanelViewModel<P>

A view model which can be used to populate R.layout.ttivi_modal_fragment.

The modal panel consists of several components. Most components can be populated by their own view model. However, the content area section is not populated by a view model and has to be populated by the ModalFragment using the ModalFragment.contentViewFactory.

A schematic overview of the modal panel template:

 ________________________________________________________________
| navigationBarViewModel iconButtonsViewModel closeButton|
| ________ ___ ___ ___ |
| | title | | | | | | X | | Header section
| |_______| |___| |___| |___| |
|________________________________________________________________|
| |
| ************************************************************* |
| ************************************************************* |
| *********************** Content area *********************** | Content area section
| ************************************************************* |
| ************************************************************* |
|________________________________________________________________|
| ____________________ | ____________________ |
| | Secondary | | | Primary | | Action buttons section
| | action button | | | action button | | populated with
| |____________________| | |____________________| | actionButtonsViewModel
|_____________________________|__________________________________|

Constructors

Link copied to clipboard
fun <P : ModalPanel> ModalViewModel(panel: P)

Properties

Link copied to clipboard

The view model for the action buttons containing the actions for the buttons. If no buttons are set, the action button section shall not be populated. By default, no action buttons are set.

Link copied to clipboard

The view model for the icon buttons. If no buttons are set, the icon button section shall not be populated. By default, no icon buttons are set.

Link copied to clipboard
open override val navigationBarViewModel: LiveData<NavigationBarViewModel?>
Link copied to clipboard
open val tag: Int? = null

ID tag which can be overridden to find a specific modal panel during tests by use of the withIdTag() matcher.

Inherited properties

Link copied to clipboard
val isSafetyLockEnabled: LiveData<Boolean>
Link copied to clipboard
val panel: P

Functions

Link copied to clipboard
open fun onCloseButtonClicked()

The close button click callback. By default dismisses only the current modal panel. If a different behavior is needed, this can be overridden.

Inherited functions

Link copied to clipboard
open fun addCloseable(@NonNull p0: Closeable)
Link copied to clipboard
override fun getLifecycle(): Lifecycle