ScreenController
class ScreenController
ScreenController provides API that allows testing of a Screen.
This controller will allows:
- Moving a
Screenthrough its differentStates. - Retrieving all
Templates returned fromonGetTemplate. The values can be reset withreset.
Summary
Public constructors |
|---|
ScreenController(screen: Screen)Creates a ScreenController to control a |
Public functions |
|
|---|---|
Screen |
Returns the |
Any? |
Returns the result that was set via |
(Mutable)List<Template!> |
Returns all the |
ScreenController |
moveToState(state: Lifecycle.State)Moves the |
Unit |
reset()Resets values tracked by this |
Public constructors
ScreenController
ScreenController(screen: Screen)
Creates a ScreenController to control a Screen for testing.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
java.lang.IllegalArgumentException |
if |
Public functions
getScreenResult
fun getScreenResult(): Any?
Returns the result that was set via setResult, or null if one was not set.
getTemplatesReturned
fun getTemplatesReturned(): (Mutable)List<Template!>
Returns all the Templates returned from onGetTemplate for the Screen being controlled.
The templates are stored in the order in which they were returned from onGetTemplate, where the first template in the list, is the first template returned.
The templates will be stored until reset is called.
moveToState
fun moveToState(state: Lifecycle.State): ScreenController
Moves the Screen being controlled to the input state.
Note that moving the Screen up a state will also push the Screen onto the androidx.car.app.ScreenManager's screen stack if it isn't the current top.
DESTROYED is a terminal state, and you cannot move to any other state after the Screen reaches that state.
| See also | |
|---|---|
getLifecycle |