bindToggleableServiceProperty

fun View.bindToggleableServiceProperty(model: ToggleableServiceProperty?, isViewEnabled: Boolean?)

Binds the view to a ToggleableServiceProperty.

The binding allows to control the view's View.isActivated and View.isEnabled states at once, as well as its View.OnClickListener. That is useful when the view is bound to a service property, whose updates are deferred and/or cannot be queued.

For example, we might have a property that can only be updated once every X seconds. This property may be bound to a view, which will be disabled for X seconds after an update was requested.

Additionally, you can set the optional parameter ttiviIsToggleableServicePropertyViewEnabled to false if the view needs to be force-disabled, regardless of the state of ttiviToggleableServiceProperty.

See also