//Android/br.com.arch.toolkit.android.statemachine/StateMachine
abstract class StateMachine<STATE : StateMachine.State>
A generic state machine for managing application or view states.
android
| Â | Â |
|---|---|
| STATE | The type of state handled by this machine, must extend StateMachine.State. |
| Â |
|---|
| SceneStateMachine |
| ViewStateMachine |
| Â | Â |
|---|---|
| StateMachine | [android] constructor() |
| Name | Summary |
|---|---|
| Config | [android] class Config Configuration for the StateMachine. |
| State | [android] abstract class State Represents a single state in the state machine. |
| Name | Summary |
|---|---|
| config | [android] val config: StateMachine.Config The configuration for this state machine. |
| isStarted | [android] var isStarted: Boolean Indicates whether the machine has been started. |
| Name | Summary |
|---|---|
| addState | [android] fun addState(key: Int, state: STATE): StateMachine<STATE> Adds a new state to the machine. |
| changeState | [android] fun changeState(stateKey: Int, forceChange: Boolean = false, onChangeState: (Int) -> Unit? = config.onChangeState) Changes the current state of the machine. |
| config | [android] inline fun config(configuration: StateMachine.Config.() -> Unit) Provides a DSL-like way to configure the StateMachine.Config. |
| getCurrentStateKey | [android] fun getCurrentStateKey(): Int Returns the key of the current state. |
| newStateInstance | [android] abstract fun newStateInstance(): STATE Creates a new instance of the specific state type. |
| restoreInstanceState | [android] fun restoreInstanceState(savedInstanceState: ERROR CLASS: Symbol not found for Bundle??): StateMachine<STATE> Restores the state of the machine from a Bundle. |
| saveInstanceState | [android] fun saveInstanceState(): android/os/Bundle Saves the current state of the machine into a Bundle. |
| setup | [android] inline fun setup(func: StateMachine<STATE>.() -> Unit) Configures and starts the StateMachine. |
| shutdown | [android] fun shutdown() Shuts down the state machine, clearing states and resetting configuration. |
| start | [android] fun start() Starts the state machine. This must be called after all states are added and initial configuration is set. |
| state | [android] inline fun state(key: Int, stateConfig: STATE.() -> Unit): StateMachine<STATE> Adds a new state to the StateMachine using a DSL-like syntax. |