TtButtonViewModel

fun TtButtonViewModel(image: DrawableResolver? = null, text: StringResolver? = null, actionType: TtButton.ActionType = TtButton.DEFAULT_ACTION_TYPE, isEnabled: Boolean = TtButton.DEFAULT_ENABLED, isActivated: Boolean = TtButton.DEFAULT_ACTIVATED, isVisible: Boolean = image != null || text != null, isBadgeVisible: Boolean = TtButton.DEFAULT_BADGE_VISIBLE, drawableTintMatchesTextColor: Boolean = TtButton.DEFAULT_DRAWABLE_TINT_MATCHES_TEXT_COLOR, @IdRes tag: Int? = null, onClick: () -> Unit = { }, onClickWhileDisabled: () -> Unit = { })

Parameters

image

The image to show next to the text within the button.

text

The text to show within the button.

actionType

The ActionType which determines the appearance of the button.

isEnabled

Indicates whether the button is enabled.

isActivated

Indicates whether the button is activated. This can be used for toggle buttons.

isVisible

Indicates if the button is visible. If no value is provided, the button is visible only if it has an image and/or text.

isBadgeVisible

Indicates if a badge should be shown on top of the button. The badge signifies that there is update relevant to the user that can be accessed by clicking the button.

drawableTintMatchesTextColor

If true the image tint color matches the text color of the ActionType.

tag

An ID to tag the button with, which can be used to identify it later. This is useful, for example, during tests in combination with the withIdTag matcher.

onClick

Callback function for when the button is clicked.

onClickWhileDisabled

Callback function for when the button is clicked when in disabled state.