ScreenViewFactory
A ViewRegistry.Entry that can build Android View instances, along with functions that can update them to display Screen renderings of a particular type, bundled together in instances of ScreenViewHolder.
Use fromLayout, fromViewBinding, etc., to create a ScreenViewFactory. These helper methods take a layout resource, view binding, or view building function as arguments, along with a factory to create a ScreenViewRunner.showRendering function.
It is rare to call buildView directly. Instead the most common path is to pass Screen instances to WorkflowViewStub.show, which will apply the ScreenViewFactory machinery for you.
If you are building a custom container and for some reason can't delegate to WorkflowViewStub, here is how to do the work yourself:
Call Screen.toViewFactory, which uses the ScreenViewFactoryFinder in the given ViewEnvironment to return the ScreenViewFactory bound to the type of the receiving Screen.
Call ScreenViewFactory.buildView to build a view wrapped in the ScreenViewHolder that manages it.
Call ScreenViewHolder.startShowing to initialize the new view with its first Screen rendering, taking care to include a ViewStarter lambda that invokes WorkflowLifecycleOwner.installOn
On subsequent updates, if ScreenViewHolder.canShow returns true, call ScreenViewHolder.show
If ScreenViewHolder.canShow returns false, it is time to tear your ScreenViewHolder down. Be sure to call WorkflowLifecycleOwner.destroyOnDetach on the managed view!
Functions
It is rare to call this method directly. Instead the most common path is to pass Screen instances to WorkflowViewStub.show, which will apply the ScreenViewFactory machinery for you.
Transforms a ScreenViewFactory of TransformedT into one that can handle instances of SourceT.
Convenience that combines ScreenViewFactory.buildView and ScreenViewHolder.startShowing, since we rarely need to do work between those two calls.