OptionViewModel

open class OptionViewModel(val imageDescriptor: LiveData<ImageDescriptor?> = EmptyLiveData(), val description: LiveData<StringResolver?> = EmptyLiveData(), val onClick: LiveData<() -> Unit?> = EmptyLiveData())

A view model be used to populate one item in the options section.

A schematic overview of the option template:

 __________________________________________________________
| _______ | |
| | | | |
| | Image | | Description |
| |______ | | |
|_____________|___________________________________________|

Parameters

imageDescriptor

The information to display in the image field. When set to null, the image field will not be visible.

description

A StringResolver for the text in the option. When set to null, no text will be displayed.

onClick

The callback to be invoked when the option is clicked.

Constructors

Link copied to clipboard
constructor(imageDescriptor: ImageDescriptor? = null, description: StringResolver? = null, onClick: () -> Unit? = null)

A convenience constructor for creating a OptionViewModel with non-live data.

constructor(imageDescriptor: LiveData<ImageDescriptor?> = EmptyLiveData(), description: LiveData<StringResolver?> = EmptyLiveData(), onClick: LiveData<() -> Unit?> = EmptyLiveData())

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val onClick: LiveData<() -> Unit?>