Skip to content

//workflow/com.squareup.workflow1.ui/ViewFactory

ViewFactory

[androidJvm] @WorkflowUiExperimentalApi()

interface ViewFactoryRenderingT : Any> : ViewRegistry.Entry<RenderingT>

This will be deprecated in favor of ScreenViewFactory very soon.

Factory for View instances that can show renderings of typeRenderingT.

Two concrete ViewFactory implementations are provided:

  • The various [bind](../-layout-runner/-companion/bind.md) methods on [LayoutRunner](../-layout-runner/index.md) allow easy use of Android XML layout resources and AndroidX ViewBinding.
  • [BuilderViewFactory](../-builder-view-factory/index.md) allows views to be built from code.

It’s simplest to have your rendering classes implement AndroidViewRendering to associate them with appropriate an appropriate ViewFactory. For more flexibility, and to avoid coupling your workflow directly to the Android runtime, see ViewRegistry.

Functions

Name Summary
buildView [androidJvm]
Content
abstract fun buildView(initialRendering: RenderingT, initialViewEnvironment: ViewEnvironment, contextForNewView: Context, container: ViewGroup? = null): View
More info
Returns a View ready to display initialRendering (and any succeeding values) via View.showRendering.


Properties

Name Summary
type [androidJvm] abstract val type: KClassRenderingT>

Inheritors

Name
BuilderViewFactory
DecorativeViewFactory