This repository was archived by the owner on Feb 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
[DNM] Introduce ViewFactoryTransformer with vibrating demo effect. #28
Draft
zach-klippenstein
wants to merge
28
commits into
weekend-features
Choose a base branch
from
zachklipp/factory-transformer
base: weekend-features
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
[DNM] Introduce ViewFactoryTransformer with vibrating demo effect. #28
zach-klippenstein
wants to merge
28
commits into
weekend-features
from
zachklipp/factory-transformer
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66a9c80
to
87afb4f
Compare
Upgrade Compose to dev11.
Upgrade gradle to latest version.
Tidy up the package structure.
…ComposeViewFactoryRoot. This ensures that the root will be applied in all code paths: - Entering the Compose world through a `WorkflowViewStub`/`ComposeViewFactory`. - Already in Compose, showing a rendering from a `WorkflowContainer`. This change also ensures that if the `ComposeViewFactoryRoot` is changed above where it's applied, the new wrapper will be applied. Adds tests for this and other logic. Fixes #20.
Make ViewFactory.showRendering function responsible for applying the ComposeViewFactoryRoot.
Most of the tests in this repo are UI tests, so it would be really nice to not build the entire codebase twice to start running them. I decreased the timeout as well since test shards no longer need to re-build.
Fix gradle cache in CI.
Update README with dependency instructions for v0.29.0.
…nnecessary intermediate Views. This is effectively the logic of `WorkflowViewStub`, but translated into Compose idioms. This approach has a few advantages: - Avoids extra custom views required to host `WorkflowViewStub` inside a Composition. Its trick of replacing itself in its parent doesn't play nice with Compose. - Allows us to pass the correct parent view for inflation (the root of the composition). - Avoids `WorkflowViewStub` having to do its own lookup to find the correct [ViewFactory], since we already have the correct one. Like `WorkflowViewStub`, this function uses the `ViewFactory` to create and memoize a `View` to display the rendering, keeps it updated with the latest `RenderingT` and `ViewEnvironment`, and adds it to the composition.
Inline WorkflowViewStub logic in ViewFactory.showRendering to avoid unnecessary intermediate Views.
Rename bindCompose to composedViewFactory.
…dering Bug fix: Make ViewRegistry.showRendering update if ViewRegistry changes.
…n function. Fixes #21, see that issue for rationale.
Rename showRendering to WorkflowRendering and make it not an extension function.
…mplementation. The root is now applied via a `ViewRegistry` wrapper that wraps individual factories to apply the root, instead of having this logic hard-coded inside `ComposeViewFactory`. This approach is more flexible in general (could be used to do other tricks), and decouples the rooting feature from the rest of the code.
Renames ComposeViewFactoryRoot to CompositionRoot and decouples the implementation.
…ent. This narrows the scope of `WorkflowContainer` to be only for showing a workflow's renderings using a `ViewEnvironment`. This elimnates the need to have separate overloads for workflows with rendering type `ComposeRendering`, and is more idiomatic – the old `WorkflowContainer` wasn't a "container" in any Compose-y sense of the word, and it was really weird that it took a content function. Now this composable is actually a container for all workflow-related composables, and so I think the name is actually appropriate (closes #22). To render a workflow without a `ViewEnvironment`, `renderAsState` is now public. This is also much more idiomatic, as it resembles APIs like `Flow<T>.collectAsState` and `Observable.subscribeAsState`.
Make renderAsState public, make WorkflowContainer take a ViewEnvironment.
Update Compose to dev12.
87afb4f
to
d6a15f2
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a
ViewRegistry
wrapper that will apply a ComposeModifier
to eachViewFactory
in the originalViewRegistry
. These modifiers can be animated, so this also includes a simple vibrating effect that randomly vibrates each factory. But this technique could be used to create a 3D "exploded" view of all the layers, like this demo.