Skip to content

//workflow/com.squareup.workflow1.ui/ScreenViewHolder

ScreenViewHolder

[androidJvm] @WorkflowUiExperimentalApi()

interface ScreenViewHolderScreenT : Screen>

Associates a view with a function (runner) that can update it to display instances of ScreenT. Also holds a reference to the ViewEnvironment that was most recently used to update the view.

environment should always hold a reference to the Screen most recently shown in view, with the key Showing. ScreenViewHolder.showing provides easy access to it. Note that the shown Screen may not be of type ScreenT, if this ScreenViewHolder is wrapped by another one. (See ScreenViewFactory.toUnwrappingViewFactory.)

Do not call runner directly. Use ScreenViewHolder.show instead. Or most commonly, allow WorkflowViewStub.show to call it for you.

Types

Name Summary
Companion [androidJvm]
Content
object Companion


Properties

Name Summary
environment [androidJvm] abstract val environment: ViewEnvironmentThe ViewEnvironment that was provided the last time view was updated by runner.
runner [androidJvm] abstract val runner: ScreenViewRunner<ScreenT>The function that is run by show to update view with a new Screen rendering and ViewEnvironment.
view [androidJvm] abstract val view: ViewThe View managed by this holder, and updated via runner

Extensions

Name Summary
canShow [androidJvm]
Content
@WorkflowUiExperimentalApi()

fun ScreenViewHolder<*>.canShow(screen: Screen): Boolean
More info
Returns true if screen is compatible with the Screen instance that was last shown by the view managed by the receiver.


show [androidJvm]
Content
@WorkflowUiExperimentalApi()

fun <ScreenT : Screen> ScreenViewHolder<ScreenT>.show(screen: ScreenT, environment: ViewEnvironment)
More info
Updates the view managed by the receiver to display screen, and updates the receiver’s environment as well.


showing [androidJvm]
Content
@WorkflowUiExperimentalApi()

val ScreenViewHolder<*>.showing: Screen
More info
Returns the Screen most recently used to update the receiver’s view via a call to show.