UseCaseState

class UseCaseState(visible: Boolean = false, embedded: Boolean = true, onFinishedRequest: UseCaseState.() -> Unit? = null, onDismissRequest: UseCaseState.() -> Unit? = null, onCloseRequest: UseCaseState.() -> Unit? = null)

Handles the base behavior of any use-case view.

Parameters

visible

If the container view is initially visible.

embedded

If the view is embedded (in a Dialog, PopUp, BottomSheet or another container that has its own state).

onCloseRequest

The listener that is invoked when the dialog was closed through any cause.

onFinishedRequest

The listener that is invoked when the dialog's use-case was finished by the user accordingly (negative, positive, selection).

onDismissRequest

The listener that is invoked when the dialog was dismissed.

Constructors

Link copied to clipboard
constructor(visible: Boolean = false, embedded: Boolean = true, onFinishedRequest: UseCaseState.() -> Unit? = null, onDismissRequest: UseCaseState.() -> Unit? = null, onCloseRequest: UseCaseState.() -> Unit? = null)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class UseCaseStateData(val visible: Boolean, val embedded: Boolean) : Serializable

Data class that stores the important information of the current state and can be used by the Saver to save and restore the state.

Functions

Link copied to clipboard
fun finish()

Finish the use-case view.

Link copied to clipboard
fun hide()

Hide the dialog / view.

Link copied to clipboard

Manually invoke the negative action. This is useful if you hid the buttons in the view.

Link copied to clipboard

Manually invoke the positive action. This is useful if you hid the buttons in the view.

Link copied to clipboard

Reset the current state data.

Link copied to clipboard
fun setManualActions(positiveAction: () -> Boolean, negativeAction: () -> Unit)
Link copied to clipboard
fun show()

Display the dialog / view.