Skip to content

Commit 9c22132

Browse files
committed
Punched up kdoc for AndroidScreen, ComposeScreen, ScreenComposableFactory
1 parent 7d6e47b commit 9c22132

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

workflow-ui/compose/src/main/java/com/squareup/workflow1/ui/compose/ComposeScreen.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.squareup.workflow1.ui.compose
22

33
import androidx.compose.runtime.Composable
4-
import com.squareup.workflow1.ui.AndroidScreen
54
import com.squareup.workflow1.ui.Screen
65
import com.squareup.workflow1.ui.ViewEnvironment
76
import com.squareup.workflow1.ui.ViewRegistry
@@ -10,7 +9,16 @@ import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
109
/**
1110
* Interface implemented by a rendering class to allow it to drive a composable UI via an
1211
* appropriate [ScreenComposableFactory] implementation, by simply overriding the [Content] method.
13-
* This is the compose analog to [AndroidScreen].
12+
*
13+
* Note that it is generally an error for a [Workflow][com.squareup.workflow1.Workflow]
14+
* to declare [ComposeScreen] as its `RenderingT` type -- prefer [Screen] for that.
15+
* [ComposeScreen], like [AndroidScreen][com.squareup.workflow1.ui.AndroidScreen],
16+
* is strictly a possible implementation detail of [Screen]. It is a convenience to
17+
* minimize the boilerplate required to set up a [ScreenComposableFactory].
18+
* That interface is the fundamental unit of Compose tooling for Workflow UI.
19+
* But in day to day use, most developer will work with [ComposeScreen] and be only
20+
* vaguely aware of the existence of [ScreenComposableFactory],
21+
* so the bulk of our description of working with Compose is here.
1422
*
1523
* **NB**: A Workflow app that relies on Compose must call [withComposeInteropSupport]
1624
* on its top-level [ViewEnvironment]. See that function for details.

workflow-ui/compose/src/main/java/com/squareup/workflow1/ui/compose/ScreenComposableFactory.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ internal fun <ScreenT : Screen> ScreenComposableFactory(
5151

5252
/**
5353
* A [ViewRegistry.Entry] that uses a [Composable] function to display [ScreenT].
54-
* This is the Compose-based analogue of
55-
* [ScreenViewFactory][com.squareup.workflow1.ui.ScreenViewFactory]. But unlike
56-
* [ScreenViewFactory], it is unusual for app developers to interact with this
57-
* class directly. Most of the time you can subclass [ComposeScreen] and rely on
58-
* the standard hidden [ScreenComposableFactory] that backs it.
54+
* This is the fundamental unit of Compose tooling in Workflow UI, the Compose analogue of
55+
* [ScreenViewFactory][com.squareup.workflow1.ui.ScreenViewFactory].
56+
*
57+
* [ScreenComposableFactory] is also a bit cumbersome to use directly,
58+
* so [ComposeScreen] is provided as a convenience. Most developers will
59+
* have no reason to work with [ScreenComposableFactory] directly, or even
60+
* be aware of it.
5961
*
6062
* - See [ComposeScreen] for a more complete description of using Compose to
6163
* build a Workflow-based UI.
@@ -78,7 +80,6 @@ internal fun <ScreenT : Screen> ScreenComposableFactory(
7880
* renderWorkflowIn(
7981
* workflow = MyWorkflow.mapRendering { it.withEnvironment(viewEnvironment) }
8082
* )
81-
*
8283
*/
8384
@WorkflowUiExperimentalApi
8485
public interface ScreenComposableFactory<in ScreenT : Screen> : ViewRegistry.Entry<ScreenT> {

workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/AndroidScreen.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package com.squareup.workflow1.ui
22

33
/**
4-
* Interface implemented by a rendering class to allow it to drive an Android UI
5-
* via an appropriate [ScreenViewFactory] implementation.
4+
* Interface implemented by a [Screen] rendering class to minimize the boilerplate
5+
* required for it to drive an Android UI via an appropriate [ScreenViewFactory]
6+
* implementation.
7+
*
8+
* Note that it is generally an error for a [Workflow][com.squareup.workflow1.Workflow]
9+
* to declare [AndroidScreen] as its `RenderingT` type -- prefer [Screen] for that.
10+
* [AndroidScreen] is strictly a possible implementation detail of [Screen].
611
*
712
* You will rarely, if ever, write a [ScreenViewFactory] yourself. Use one
813
* of its [companion methods][ScreenViewFactory.Companion] like [ScreenViewFactory.fromViewBinding]

0 commit comments

Comments
 (0)