UIState

In package com.nhaarman.acorn.android.uistate

class com.nhaarman.acorn.android.uistate.UIState

A sealed hierarchy that manages layout inflation and Scene transition animations.

These set of classes form a state machine that can manage switching views when a new Scene becomes active.

Invoking methods on this class may cause a state transition: the resulting state is returned. Consumers of this class must call its methods at the appropriate times (uiVisible, uiNotVisible, withScene, withoutScene) and update their reference to the resulting state accordingly.

This class is not thread-safe, and should only be invoked from the main thread.

Methods

abstract fun uiVisible(): UIState

Denotes that the UI window becomes visible to the user.

Parameters:
  • No parameters
abstract fun uiNotVisible(): UIState

Denotes that the UI window becomes invisible to the user.

Parameters:
  • No parameters
abstract fun onBackPressed(): Boolean

Invoked when the user presses the back button.

Implementations can consume the event by returning true and stop further propagation of the event.

Parameters:
  • No parameters
fun withScene(scene: Scene, viewControllerFactory: ViewControllerFactory, data: TransitionData?): UIState

Applies given scene to the UI.

Parameters:
abstract fun withoutScene(): UIState

Indicates that there is no local Scene currently active.

Parameters:
  • No parameters