From debc500d6dfc4f9de38d801f0c8adec3391688cf Mon Sep 17 00:00:00 2001 From: Zach Klippenstein Date: Fri, 15 May 2020 16:31:48 -0700 Subject: [PATCH] Tidy up the package structure. This change reorganizes some of the wrapper logic to live closer to related code, and moves a bunch of internal-only helper code into an internal package to make the public API more browseable. --- compose-tooling/api/compose-tooling.api | 4 +- .../tooling/PreviewComposeWorkflowTest.kt | 2 +- .../ui/compose/tooling/ComposeWorkflows.kt | 2 +- core-compose/api/core-compose.api | 36 ++++++++-------- .../ui/compose/ComposeViewFactoryRootTest.kt | 1 + .../{ => ui}/compose/ComposeRendering.kt | 7 ++- .../workflow/ui/compose/ComposeViewFactory.kt | 3 ++ .../{ => ui}/compose/ComposeWorkflow.kt | 3 +- .../workflow/ui/compose/ViewEnvironments.kt | 1 + .../workflow/ui/compose/WorkflowContainer.kt | 1 - .../compose/{ => internal}/ComposeSupport.kt | 12 +++--- .../compose/internal}/ComposeWorkflowImpl.kt | 6 ++- .../{ => internal}/CompositionContinuation.kt | 2 +- .../SafeComposeViewFactoryRoot.kt | 3 +- .../compose/{ => internal}/ViewFactories.kt | 5 ++- .../compose/{ => internal}/ViewRegistries.kt | 2 +- .../HelloComposeRenderingActivity.kt | 2 +- .../HelloRenderingWorkflow.kt | 2 +- .../hellocomposerendering/HelloWorkflow.kt | 2 +- .../ui/compose/tooling/ComposeWorkflows.kt | 43 ------------------- 20 files changed, 52 insertions(+), 87 deletions(-) rename core-compose/src/main/java/com/squareup/workflow/{ => ui}/compose/ComposeRendering.kt (86%) rename core-compose/src/main/java/com/squareup/workflow/{ => ui}/compose/ComposeWorkflow.kt (96%) rename core-compose/src/main/java/com/squareup/workflow/ui/compose/{ => internal}/ComposeSupport.kt (90%) rename core-compose/src/main/java/com/squareup/workflow/{compose => ui/compose/internal}/ComposeWorkflowImpl.kt (92%) rename core-compose/src/main/java/com/squareup/workflow/ui/compose/{ => internal}/CompositionContinuation.kt (97%) rename core-compose/src/main/java/com/squareup/workflow/ui/compose/{ => internal}/SafeComposeViewFactoryRoot.kt (92%) rename core-compose/src/main/java/com/squareup/workflow/ui/compose/{ => internal}/ViewFactories.kt (94%) rename core-compose/src/main/java/com/squareup/workflow/ui/compose/{ => internal}/ViewRegistries.kt (96%) delete mode 100644 samples/nested-renderings/src/main/res/values/java/com/squareup/workflow/ui/compose/tooling/ComposeWorkflows.kt diff --git a/compose-tooling/api/compose-tooling.api b/compose-tooling/api/compose-tooling.api index 685ec830..c283e9b9 100644 --- a/compose-tooling/api/compose-tooling.api +++ b/compose-tooling/api/compose-tooling.api @@ -6,8 +6,8 @@ public final class com/squareup/workflow/ui/compose/tooling/BuildConfig { } public final class com/squareup/workflow/ui/compose/tooling/ComposeWorkflowsKt { - public static final fun preview (Lcom/squareup/workflow/compose/ComposeWorkflow;Ljava/lang/Object;Landroidx/ui/core/Modifier;Landroidx/ui/core/Modifier;Lkotlin/jvm/functions/Function1;Landroidx/compose/Composer;)V - public static synthetic fun preview$default (Lcom/squareup/workflow/compose/ComposeWorkflow;Ljava/lang/Object;Landroidx/ui/core/Modifier;Landroidx/ui/core/Modifier;Lkotlin/jvm/functions/Function1;Landroidx/compose/Composer;ILjava/lang/Object;)V + public static final fun preview (Lcom/squareup/workflow/ui/compose/ComposeWorkflow;Ljava/lang/Object;Landroidx/ui/core/Modifier;Landroidx/ui/core/Modifier;Lkotlin/jvm/functions/Function1;Landroidx/compose/Composer;)V + public static synthetic fun preview$default (Lcom/squareup/workflow/ui/compose/ComposeWorkflow;Ljava/lang/Object;Landroidx/ui/core/Modifier;Landroidx/ui/core/Modifier;Lkotlin/jvm/functions/Function1;Landroidx/compose/Composer;ILjava/lang/Object;)V } public final class com/squareup/workflow/ui/compose/tooling/ViewFactoriesKt { diff --git a/compose-tooling/src/androidTest/java/com/squareup/workflow/ui/compose/tooling/PreviewComposeWorkflowTest.kt b/compose-tooling/src/androidTest/java/com/squareup/workflow/ui/compose/tooling/PreviewComposeWorkflowTest.kt index 7feab89d..8b9b542e 100644 --- a/compose-tooling/src/androidTest/java/com/squareup/workflow/ui/compose/tooling/PreviewComposeWorkflowTest.kt +++ b/compose-tooling/src/androidTest/java/com/squareup/workflow/ui/compose/tooling/PreviewComposeWorkflowTest.kt @@ -31,7 +31,7 @@ import androidx.ui.test.findByText import androidx.ui.tooling.preview.Preview import androidx.ui.unit.dp import com.squareup.workflow.Workflow -import com.squareup.workflow.compose.composed +import com.squareup.workflow.ui.compose.composed import com.squareup.workflow.ui.ViewEnvironmentKey import com.squareup.workflow.ui.compose.showRendering import org.junit.Rule diff --git a/compose-tooling/src/main/java/com/squareup/workflow/ui/compose/tooling/ComposeWorkflows.kt b/compose-tooling/src/main/java/com/squareup/workflow/ui/compose/tooling/ComposeWorkflows.kt index c01324ed..97be5980 100644 --- a/compose-tooling/src/main/java/com/squareup/workflow/ui/compose/tooling/ComposeWorkflows.kt +++ b/compose-tooling/src/main/java/com/squareup/workflow/ui/compose/tooling/ComposeWorkflows.kt @@ -21,7 +21,7 @@ import androidx.compose.Composable import androidx.ui.core.Modifier import androidx.ui.foundation.Box import com.squareup.workflow.Sink -import com.squareup.workflow.compose.ComposeWorkflow +import com.squareup.workflow.ui.compose.ComposeWorkflow import com.squareup.workflow.ui.ViewEnvironment import com.squareup.workflow.ui.ViewFactory import com.squareup.workflow.ui.ViewRegistry diff --git a/core-compose/api/core-compose.api b/core-compose/api/core-compose.api index 096578eb..2005694d 100644 --- a/core-compose/api/core-compose.api +++ b/core-compose/api/core-compose.api @@ -1,26 +1,12 @@ -public final class com/squareup/workflow/compose/ComposeRendering { - public static final field Companion Lcom/squareup/workflow/compose/ComposeRendering$Companion; +public final class com/squareup/workflow/ui/compose/ComposeRendering { + public static final field Companion Lcom/squareup/workflow/ui/compose/ComposeRendering$Companion; public static final fun ()V public fun (Lkotlin/jvm/functions/Function2;)V } -public final class com/squareup/workflow/compose/ComposeRendering$Companion { +public final class com/squareup/workflow/ui/compose/ComposeRendering$Companion { public final fun getFactory ()Lcom/squareup/workflow/ui/ViewFactory; - public final fun getNoopRendering ()Lcom/squareup/workflow/compose/ComposeRendering; -} - -public abstract class com/squareup/workflow/compose/ComposeWorkflow : com/squareup/workflow/Workflow { - public fun ()V - public fun asStatefulWorkflow ()Lcom/squareup/workflow/StatefulWorkflow; - public abstract fun render (Ljava/lang/Object;Lcom/squareup/workflow/Sink;Lcom/squareup/workflow/ui/ViewEnvironment;Landroidx/compose/Composer;)V -} - -public final class com/squareup/workflow/compose/ComposeWorkflowKt { - public static final fun composed (Lcom/squareup/workflow/Workflow$Companion;Lkotlin/jvm/functions/Function4;)Lcom/squareup/workflow/compose/ComposeWorkflow; -} - -public final class com/squareup/workflow/ui/compose/ComposeSupportKt { - public static final fun ()V + public final fun getNoopRendering ()Lcom/squareup/workflow/ui/compose/ComposeRendering; } public final class com/squareup/workflow/ui/compose/ComposeViewFactory : com/squareup/workflow/ui/ViewFactory { @@ -46,6 +32,16 @@ public final class com/squareup/workflow/ui/compose/ComposeViewFactoryRootKt { public static final fun withComposeViewFactoryRoot (Lcom/squareup/workflow/ui/ViewEnvironment;Lkotlin/jvm/functions/Function2;)Lcom/squareup/workflow/ui/ViewEnvironment; } +public abstract class com/squareup/workflow/ui/compose/ComposeWorkflow : com/squareup/workflow/Workflow { + public fun ()V + public fun asStatefulWorkflow ()Lcom/squareup/workflow/StatefulWorkflow; + public abstract fun render (Ljava/lang/Object;Lcom/squareup/workflow/Sink;Lcom/squareup/workflow/ui/ViewEnvironment;Landroidx/compose/Composer;)V +} + +public final class com/squareup/workflow/ui/compose/ComposeWorkflowKt { + public static final fun composed (Lcom/squareup/workflow/Workflow$Companion;Lkotlin/jvm/functions/Function4;)Lcom/squareup/workflow/ui/compose/ComposeWorkflow; +} + public final class com/squareup/workflow/ui/compose/ViewEnvironmentsKt { public static final fun showRendering (Lcom/squareup/workflow/ui/ViewEnvironment;Ljava/lang/Object;Landroidx/ui/core/Modifier;Landroidx/compose/Composer;)V public static synthetic fun showRendering$default (Lcom/squareup/workflow/ui/ViewEnvironment;Ljava/lang/Object;Landroidx/ui/core/Modifier;Landroidx/compose/Composer;ILjava/lang/Object;)V @@ -70,6 +66,10 @@ public final class com/squareup/workflow/ui/compose/WorkflowContainerKt { public static synthetic fun WorkflowContainer$default (Lcom/squareup/workflow/Workflow;Lkotlin/jvm/functions/Function1;Landroidx/ui/core/Modifier;Lcom/squareup/workflow/diagnostic/WorkflowDiagnosticListener;Lkotlin/jvm/functions/Function2;Landroidx/compose/Composer;ILjava/lang/Object;)V } +public final class com/squareup/workflow/ui/compose/internal/ComposeSupportKt { + public static final fun ()V +} + public final class com/squareup/workflow/ui/core/compose/BuildConfig { public static final field BUILD_TYPE Ljava/lang/String; public static final field DEBUG Z diff --git a/core-compose/src/androidTest/java/com/squareup/workflow/ui/compose/ComposeViewFactoryRootTest.kt b/core-compose/src/androidTest/java/com/squareup/workflow/ui/compose/ComposeViewFactoryRootTest.kt index be85cbce..e27c6455 100644 --- a/core-compose/src/androidTest/java/com/squareup/workflow/ui/compose/ComposeViewFactoryRootTest.kt +++ b/core-compose/src/androidTest/java/com/squareup/workflow/ui/compose/ComposeViewFactoryRootTest.kt @@ -23,6 +23,7 @@ import androidx.ui.test.assertIsDisplayed import androidx.ui.test.createComposeRule import androidx.ui.test.findByText import com.google.common.truth.Truth.assertThat +import com.squareup.workflow.ui.compose.internal.SafeComposeViewFactoryRoot import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith diff --git a/core-compose/src/main/java/com/squareup/workflow/compose/ComposeRendering.kt b/core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeRendering.kt similarity index 86% rename from core-compose/src/main/java/com/squareup/workflow/compose/ComposeRendering.kt rename to core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeRendering.kt index 13c303e3..466fcafd 100644 --- a/core-compose/src/main/java/com/squareup/workflow/compose/ComposeRendering.kt +++ b/core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeRendering.kt @@ -15,14 +15,13 @@ */ @file:Suppress("RemoveEmptyParenthesesFromAnnotationEntry") -package com.squareup.workflow.compose +package com.squareup.workflow.ui.compose import androidx.compose.Composable -import com.squareup.workflow.compose.ComposeRendering.Companion.Factory -import com.squareup.workflow.compose.ComposeRendering.Companion.NoopRendering +import com.squareup.workflow.ui.compose.ComposeRendering.Companion.Factory +import com.squareup.workflow.ui.compose.ComposeRendering.Companion.NoopRendering import com.squareup.workflow.ui.ViewEnvironment import com.squareup.workflow.ui.ViewFactory -import com.squareup.workflow.ui.compose.bindCompose /** * A workflow rendering that renders itself using a [Composable] function. diff --git a/core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeViewFactory.kt b/core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeViewFactory.kt index aa021169..2afb6797 100644 --- a/core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeViewFactory.kt +++ b/core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeViewFactory.kt @@ -31,6 +31,9 @@ import androidx.ui.core.setContent import com.squareup.workflow.ui.ViewEnvironment import com.squareup.workflow.ui.ViewFactory import com.squareup.workflow.ui.bindShowRendering +import com.squareup.workflow.ui.compose.internal.CompositionContinuation +import com.squareup.workflow.ui.compose.internal.SafeComposeViewFactoryRoot +import com.squareup.workflow.ui.compose.internal.setContent import kotlin.reflect.KClass /** diff --git a/core-compose/src/main/java/com/squareup/workflow/compose/ComposeWorkflow.kt b/core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeWorkflow.kt similarity index 96% rename from core-compose/src/main/java/com/squareup/workflow/compose/ComposeWorkflow.kt rename to core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeWorkflow.kt index 3f435d22..1a30bcb6 100644 --- a/core-compose/src/main/java/com/squareup/workflow/compose/ComposeWorkflow.kt +++ b/core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeWorkflow.kt @@ -15,13 +15,14 @@ */ @file:Suppress("RemoveEmptyParenthesesFromAnnotationEntry") -package com.squareup.workflow.compose +package com.squareup.workflow.ui.compose import androidx.compose.Composable import com.squareup.workflow.Sink import com.squareup.workflow.StatefulWorkflow import com.squareup.workflow.Workflow import com.squareup.workflow.ui.ViewEnvironment +import com.squareup.workflow.ui.compose.internal.ComposeWorkflowImpl /** * A stateless [Workflow][com.squareup.workflow.Workflow] that [renders][render] itself as diff --git a/core-compose/src/main/java/com/squareup/workflow/ui/compose/ViewEnvironments.kt b/core-compose/src/main/java/com/squareup/workflow/ui/compose/ViewEnvironments.kt index e7419396..cdb618f5 100644 --- a/core-compose/src/main/java/com/squareup/workflow/ui/compose/ViewEnvironments.kt +++ b/core-compose/src/main/java/com/squareup/workflow/ui/compose/ViewEnvironments.kt @@ -20,6 +20,7 @@ import androidx.compose.remember import androidx.ui.core.Modifier import com.squareup.workflow.ui.ViewEnvironment import com.squareup.workflow.ui.ViewRegistry +import com.squareup.workflow.ui.compose.internal.showRendering /** * Renders [rendering] into the composition using this [ViewEnvironment]'s diff --git a/core-compose/src/main/java/com/squareup/workflow/ui/compose/WorkflowContainer.kt b/core-compose/src/main/java/com/squareup/workflow/ui/compose/WorkflowContainer.kt index c7900697..643af54f 100644 --- a/core-compose/src/main/java/com/squareup/workflow/ui/compose/WorkflowContainer.kt +++ b/core-compose/src/main/java/com/squareup/workflow/ui/compose/WorkflowContainer.kt @@ -40,7 +40,6 @@ import androidx.ui.savedinstancestate.UiSavedStateRegistryAmbient import androidx.ui.savedinstancestate.savedInstanceState import com.squareup.workflow.Snapshot import com.squareup.workflow.Workflow -import com.squareup.workflow.compose.ComposeRendering import com.squareup.workflow.diagnostic.WorkflowDiagnosticListener import com.squareup.workflow.launchWorkflowIn import com.squareup.workflow.ui.ViewEnvironment diff --git a/core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeSupport.kt b/core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/ComposeSupport.kt similarity index 90% rename from core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeSupport.kt rename to core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/ComposeSupport.kt index d195a269..50621727 100644 --- a/core-compose/src/main/java/com/squareup/workflow/ui/compose/ComposeSupport.kt +++ b/core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/ComposeSupport.kt @@ -15,7 +15,7 @@ */ @file:Suppress("RemoveEmptyParenthesesFromAnnotationEntry") -package com.squareup.workflow.ui.compose +package com.squareup.workflow.ui.compose.internal import android.content.Context import android.view.View @@ -27,11 +27,11 @@ import androidx.compose.Recomposer import androidx.compose.compositionFor import androidx.lifecycle.LifecycleOwner import androidx.ui.node.UiComposer -import com.squareup.workflow.ui.compose.ReflectionSupport.ANDROID_OWNER_CLASS -import com.squareup.workflow.ui.compose.ReflectionSupport.androidOwnerView -import com.squareup.workflow.ui.compose.ReflectionSupport.createOwner -import com.squareup.workflow.ui.compose.ReflectionSupport.createWrappedContent -import com.squareup.workflow.ui.compose.ReflectionSupport.ownerRoot +import com.squareup.workflow.ui.compose.internal.ReflectionSupport.ANDROID_OWNER_CLASS +import com.squareup.workflow.ui.compose.internal.ReflectionSupport.androidOwnerView +import com.squareup.workflow.ui.compose.internal.ReflectionSupport.createOwner +import com.squareup.workflow.ui.compose.internal.ReflectionSupport.createWrappedContent +import com.squareup.workflow.ui.compose.internal.ReflectionSupport.ownerRoot import com.squareup.workflow.ui.core.compose.R private typealias AndroidOwner = Any diff --git a/core-compose/src/main/java/com/squareup/workflow/compose/ComposeWorkflowImpl.kt b/core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/ComposeWorkflowImpl.kt similarity index 92% rename from core-compose/src/main/java/com/squareup/workflow/compose/ComposeWorkflowImpl.kt rename to core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/ComposeWorkflowImpl.kt index cdd4eca9..efdb89fb 100644 --- a/core-compose/src/main/java/com/squareup/workflow/compose/ComposeWorkflowImpl.kt +++ b/core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/ComposeWorkflowImpl.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.squareup.workflow.compose +package com.squareup.workflow.ui.compose.internal import androidx.compose.MutableState import androidx.compose.StructurallyEqual @@ -23,8 +23,10 @@ import com.squareup.workflow.Sink import com.squareup.workflow.Snapshot import com.squareup.workflow.StatefulWorkflow import com.squareup.workflow.action -import com.squareup.workflow.compose.ComposeWorkflowImpl.State +import com.squareup.workflow.ui.compose.internal.ComposeWorkflowImpl.State import com.squareup.workflow.contraMap +import com.squareup.workflow.ui.compose.ComposeRendering +import com.squareup.workflow.ui.compose.ComposeWorkflow internal class ComposeWorkflowImpl( private val workflow: ComposeWorkflow diff --git a/core-compose/src/main/java/com/squareup/workflow/ui/compose/CompositionContinuation.kt b/core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/CompositionContinuation.kt similarity index 97% rename from core-compose/src/main/java/com/squareup/workflow/ui/compose/CompositionContinuation.kt rename to core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/CompositionContinuation.kt index 4f7980e3..4d789b9a 100644 --- a/core-compose/src/main/java/com/squareup/workflow/ui/compose/CompositionContinuation.kt +++ b/core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/CompositionContinuation.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.squareup.workflow.ui.compose +package com.squareup.workflow.ui.compose.internal import androidx.compose.Composable import androidx.compose.CompositionReference diff --git a/core-compose/src/main/java/com/squareup/workflow/ui/compose/SafeComposeViewFactoryRoot.kt b/core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/SafeComposeViewFactoryRoot.kt similarity index 92% rename from core-compose/src/main/java/com/squareup/workflow/ui/compose/SafeComposeViewFactoryRoot.kt rename to core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/SafeComposeViewFactoryRoot.kt index 804b7155..c2460be2 100644 --- a/core-compose/src/main/java/com/squareup/workflow/ui/compose/SafeComposeViewFactoryRoot.kt +++ b/core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/SafeComposeViewFactoryRoot.kt @@ -15,9 +15,10 @@ */ @file:Suppress("RemoveEmptyParenthesesFromAnnotationEntry") -package com.squareup.workflow.ui.compose +package com.squareup.workflow.ui.compose.internal import androidx.compose.Composable +import com.squareup.workflow.ui.compose.ComposeViewFactoryRoot /** * [ComposeViewFactoryRoot] that asserts that the [wrap] method invokes its children parameter diff --git a/core-compose/src/main/java/com/squareup/workflow/ui/compose/ViewFactories.kt b/core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/ViewFactories.kt similarity index 94% rename from core-compose/src/main/java/com/squareup/workflow/ui/compose/ViewFactories.kt rename to core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/ViewFactories.kt index 0dc5afbd..edd9290f 100644 --- a/core-compose/src/main/java/com/squareup/workflow/ui/compose/ViewFactories.kt +++ b/core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/ViewFactories.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.squareup.workflow.ui.compose +package com.squareup.workflow.ui.compose.internal import android.content.Context import android.view.ViewGroup.LayoutParams.MATCH_PARENT @@ -24,7 +24,8 @@ import androidx.ui.foundation.Box import com.squareup.workflow.ui.ViewEnvironment import com.squareup.workflow.ui.ViewFactory import com.squareup.workflow.ui.WorkflowViewStub -import com.squareup.workflow.ui.compose.ComposableViewStubWrapper.Update +import com.squareup.workflow.ui.compose.ComposeViewFactory +import com.squareup.workflow.ui.compose.internal.ComposableViewStubWrapper.Update /** * Renders [rendering] into the composition using the `ViewRegistry` from the [ViewEnvironment] to diff --git a/core-compose/src/main/java/com/squareup/workflow/ui/compose/ViewRegistries.kt b/core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/ViewRegistries.kt similarity index 96% rename from core-compose/src/main/java/com/squareup/workflow/ui/compose/ViewRegistries.kt rename to core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/ViewRegistries.kt index aec3b468..80f6f2aa 100644 --- a/core-compose/src/main/java/com/squareup/workflow/ui/compose/ViewRegistries.kt +++ b/core-compose/src/main/java/com/squareup/workflow/ui/compose/internal/ViewRegistries.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.squareup.workflow.ui.compose +package com.squareup.workflow.ui.compose.internal import androidx.compose.Composable import androidx.compose.remember diff --git a/samples/hello-compose-rendering/src/main/java/com/squareup/sample/hellocomposerendering/HelloComposeRenderingActivity.kt b/samples/hello-compose-rendering/src/main/java/com/squareup/sample/hellocomposerendering/HelloComposeRenderingActivity.kt index 3bf82072..2877316d 100644 --- a/samples/hello-compose-rendering/src/main/java/com/squareup/sample/hellocomposerendering/HelloComposeRenderingActivity.kt +++ b/samples/hello-compose-rendering/src/main/java/com/squareup/sample/hellocomposerendering/HelloComposeRenderingActivity.kt @@ -17,7 +17,7 @@ package com.squareup.sample.hellocomposerendering import android.os.Bundle import androidx.appcompat.app.AppCompatActivity -import com.squareup.workflow.compose.ComposeRendering +import com.squareup.workflow.ui.compose.ComposeRendering import com.squareup.workflow.diagnostic.SimpleLoggingDiagnosticListener import com.squareup.workflow.ui.ViewRegistry import com.squareup.workflow.ui.WorkflowRunner diff --git a/samples/hello-compose-rendering/src/main/java/com/squareup/sample/hellocomposerendering/HelloRenderingWorkflow.kt b/samples/hello-compose-rendering/src/main/java/com/squareup/sample/hellocomposerendering/HelloRenderingWorkflow.kt index 1285fe1b..1cd1906c 100644 --- a/samples/hello-compose-rendering/src/main/java/com/squareup/sample/hellocomposerendering/HelloRenderingWorkflow.kt +++ b/samples/hello-compose-rendering/src/main/java/com/squareup/sample/hellocomposerendering/HelloRenderingWorkflow.kt @@ -27,7 +27,7 @@ import androidx.ui.material.ripple.ripple import androidx.ui.tooling.preview.Preview import com.squareup.sample.hellocomposerendering.HelloRenderingWorkflow.Toggle import com.squareup.workflow.Sink -import com.squareup.workflow.compose.ComposeWorkflow +import com.squareup.workflow.ui.compose.ComposeWorkflow import com.squareup.workflow.ui.ViewEnvironment import com.squareup.workflow.ui.compose.tooling.preview diff --git a/samples/hello-compose-rendering/src/main/java/com/squareup/sample/hellocomposerendering/HelloWorkflow.kt b/samples/hello-compose-rendering/src/main/java/com/squareup/sample/hellocomposerendering/HelloWorkflow.kt index 2d784cfc..5654a75a 100644 --- a/samples/hello-compose-rendering/src/main/java/com/squareup/sample/hellocomposerendering/HelloWorkflow.kt +++ b/samples/hello-compose-rendering/src/main/java/com/squareup/sample/hellocomposerendering/HelloWorkflow.kt @@ -22,7 +22,7 @@ import com.squareup.workflow.RenderContext import com.squareup.workflow.Snapshot import com.squareup.workflow.StatefulWorkflow import com.squareup.workflow.action -import com.squareup.workflow.compose.ComposeRendering +import com.squareup.workflow.ui.compose.ComposeRendering import com.squareup.workflow.parse object HelloWorkflow : StatefulWorkflow() { diff --git a/samples/nested-renderings/src/main/res/values/java/com/squareup/workflow/ui/compose/tooling/ComposeWorkflows.kt b/samples/nested-renderings/src/main/res/values/java/com/squareup/workflow/ui/compose/tooling/ComposeWorkflows.kt deleted file mode 100644 index 85d10445..00000000 --- a/samples/nested-renderings/src/main/res/values/java/com/squareup/workflow/ui/compose/tooling/ComposeWorkflows.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2020 Square Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.squareup.workflow.ui.compose.tooling - -import androidx.compose.Composable -import androidx.compose.Immutable -import com.squareup.workflow.Sink -import com.squareup.workflow.compose.ComposeWorkflow -import com.squareup.workflow.ui.ViewBinding - -/** - * Draws this [ComposeWorkflow] using a special preview `ViewRegistry`. - * - * The sink passed to [ComposeWorkflow.render] will be a no-op implementation, since previews can't - * process input. - * - * Use inside `@Preview` Composable functions. - */ -//@Composable fun ComposeWorkflow.preview( -// props: PropsT, -// stubBinding: ViewBinding = PreviewStubViewBinding -//) { -// val containerHints = PreviewContainerHints(stubBinding) -// render(props, NoopSink, containerHints) -//} - -//@Immutable -//private object NoopSink : Sink { -// override fun send(value: Any?) = Unit -//}