//workflow/com.squareup.workflow1.ui/ViewRegistry
ViewRegistry¶
[jvm] @WorkflowUiExperimentalApi()
interface ViewRegistry
The ViewEnvironment service that can be used to display the stream of renderings from a workflow tree as View instances. This is the engine behind AndroidViewRendering, WorkflowViewStub and ViewFactory. Most apps can ignore ViewRegistry as an implementation detail, by using AndroidViewRendering to tie their rendering classes to view code.
To avoid that coupling between workflow code and the Android runtime, registries can be loaded with ViewFactory instances at runtime, and provided as an optional parameter to WorkflowLayout.start.
For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
In the above example, it is assumed that the companion objects of the various decoupled LayoutRunner classes honor a convention of implementing ViewFactory, in aid of this kind of assembly.
1 2 3 4 5 6 7 8 |
|
Types¶
Name | Summary |
---|---|
Companion | [jvm] Content object Companion : ViewEnvironmentKey<ViewRegistry> |
Entry | [jvm] Content interface Entry |
Functions¶
Name | Summary |
---|---|
getEntryFor | [jvm] Content abstract fun <RenderingT : Any> getEntryFor(renderingType: KClass More info Returns the Entry that was registered for the given renderingType, or null if none was found. |
Properties¶
Name | Summary |
---|---|
keys | [jvm] abstract val keys: Set<KClass<*>>The set of unique keys which this registry can derive from the renderings passed to getEntryFor and for which it knows how to create views. |
Extensions¶
Name | Summary |
---|---|
buildView | [androidJvm] Content @WorkflowUiExperimentalApi() fun <RenderingT : Any> ViewRegistry.buildView(initialRendering: RenderingT, initialViewEnvironment: ViewEnvironment, contextForNewView: Context, container: ViewGroup? = null, viewStarter: ViewStarter? = null): View More info This will be deprecated in favor of ScreenViewFactory.startShowing very soon. |
get | [jvm] Content @WorkflowUiExperimentalApi() inline operator fun <RenderingT : Any> ViewRegistry.get(renderingType: KClass |
getFactoryFor | [androidJvm] Content @WorkflowUiExperimentalApi() fun <RenderingT : Any> ViewRegistry.getFactoryFor(renderingType: KClass More info This will be deprecated in favor of ViewRegistry.getEntryFor very soon. |
getFactoryForRendering | [androidJvm] Content @WorkflowUiExperimentalApi() fun <RenderingT : Any> ViewRegistry.getFactoryForRendering(rendering: RenderingT): ViewFactory<RenderingT> More info This will be deprecated in favor of ScreenViewFactoryFinder.getViewFactoryForRendering very soon. |
merge | [jvm] Content @WorkflowUiExperimentalApi() infix fun ViewRegistry.merge(other: ViewRegistry): ViewRegistry More info Combines the receiver with other. |
plus | [jvm] Content @WorkflowUiExperimentalApi() operator fun ViewRegistry.plus(entry: ViewRegistry.Entry<*>): ViewRegistry More info Transforms the receiver to add entry, throwing IllegalArgumentException if the receiver already has a matching entry. [jvm] Content @WorkflowUiExperimentalApi() operator fun ViewRegistry.plus(other: ViewRegistry): ViewRegistry More info Transforms the receiver to add all entries from other, throwing IllegalArgumentException if the receiver already has any matching entry. |