-
Notifications
You must be signed in to change notification settings - Fork 112
Container and Wrapper interfaces, improved forWrapper()
#920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
workflow-ui/core-common/src/main/java/com/squareup/workflow1/ui/AsScreen.kt
Outdated
Show resolved
Hide resolved
steve-the-edwards
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😵 . I hope I managed to understand things.
workflow-ui/core-common/src/main/java/com/squareup/workflow1/ui/Container.kt
Outdated
Show resolved
Hide resolved
workflow-ui/core-common/src/main/java/com/squareup/workflow1/ui/Container.kt
Outdated
Show resolved
Hide resolved
workflow-ui/core-common/src/main/java/com/squareup/workflow1/ui/Container.kt
Outdated
Show resolved
Hide resolved
workflow-ui/core-common/src/main/java/com/squareup/workflow1/ui/AsScreen.kt
Outdated
Show resolved
Hide resolved
workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/ScreenViewFactory.kt
Show resolved
Hide resolved
workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/ScreenViewFactory.kt
Show resolved
Hide resolved
|
Update:
|
|
Update:
God bless CI and unit tests. |
db1005c to
5f65bec
Compare
samples/containers/common/src/main/java/com/squareup/sample/container/panel/PanelOverlay.kt
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| /** | ||
| * A singleton [Container] -- that is, a rendering which wraps a single rendering of type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "singleton" Container still throws me off as I think, oh - it makes it so that this Rendering is a Singleton; which, i get, is absurd but I need the explanation sentence anyway so why not change what we are summarizing this as?
"A frame [Container]"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* A [Container] rendering that wraps exactly one other rendering, its [content]. These are
* typically used to "add value" to the [content], e.g. an
* [EnvironmentScreen][com.squareup.workflow1.ui.container.EnvironmentScreen] that allows
* changes to be made to the the [ViewEnvironment].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the the" :/
ece4923 to
7cd607f
Compare
|
Addressed the last couple of issues that @steve-the-edwards raised, thanks Steve. Holding off on merging this until #944 has been vetted, maybe until it's published. |
Introduces the `Container` and `Wrapper` types, giving Workflow UI its first general notion of structure. Their integration with `Compatibile` reduces the likelihood of making the most common mistake with wrapper types (namely, forgetting to do that). And they standardize the `map()` function that gets implemented by wrappers more often than not. Also updates `forWrapper` and `toUnwrappingViewFactory` to be defined in terms of `Wrapper`, allowing us to simplify their APIs by relying on `Wrapper.content` in default lambda implementations. And while we're in the neighborhood, adds long needed `prepEnvironment` and `prepContext` function arguments that simplify transforming a `ScreenViewFactory` to pre-process its `ViewEnvironment` and `Context`. We use this new capability to simplify the default `ScreenViewFactory` implementation for `EnvironmentScreen`. Closes #916
And can demonstrate the bug where dialogs are shown out of order: - Click _Cover Everything_ - Click _Cover Body_ The red inner dialog is shown over the outer green dialog, but the green one should always be on top. (#966) Also introduces `name` parameter for `BodyAndOverlaysScreen`, because they're a nightmare to nest without it. See the kdoc for details.
- Replaces `View.getGlobalVisibleRect` calls with new, more robust `View.getScreenRect` extension - `Dialog.setBounds` sets `FLAG_LAYOUT_IN_SCREEN` to ensure `Dialog` is really placed where we want it. Otherwise it may be offset by the height of the toolbar. I think we've missed this up until now because our other samples and prod use all have richer themes than the default codepaths set up. - Default `ScreenOverlayDialogFactory` implementation disables dimming, for least confusing out of box behavior. Note that these tweaks do not address #966, that's a bigger effort.
Trying to reduce Espresso flakes by being more careful and conventional about `RootMatcher` use; about targetting back button presses; and by using `recreate()` for configuration changes.
Nested overlays sample, small bug fixes
|
I've merged #967 down into this branch, merged master into it, and have set this for auto-merge. |
Introduces the
ContainerandWrappertypes, giving Workflow UI its first general notion of structure. Their integration withCompatibilereduces the likelihood of making the most common mistake with wrapper types (namely, forgetting to do that). And they standardize themap()function that gets implemented by wrappers more often than not.Also updates
forWrapperandtoUnwrappingViewFactoryto be defined in terms ofWrapper, allowing us to simplify their APIs by relying onWrapper.contentin default lambda implementations.And while we're in the neighborhood, adds long needed
prepEnvironmentandprepContextfunction arguments that simplify transforming aScreenViewFactoryto pre-process itsViewEnvironmentandContext. We use this new capability to simplify the defaultScreenViewFactoryimplementation forEnvironmentScreen.Closes #916