Skip to content
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

Replaces Showing and InOverlay with View tags. #845

Merged
merged 1 commit into from
Jul 29, 2022

Conversation

rjrjr
Copy link
Contributor

@rjrjr rjrjr commented Jul 28, 2022

Using the ViewEnvironment to hold the current Screen and Overlay was conceptually very clean, but was bad for performance in Compose, which would recompose too often when a new ViewEnvironment was not equal to the previous one -- all due to Showing being updated. We now store the canonical Screen rendering for each View in a tag, and the Overlay for each Dialog in a tag on its decorView.

Fixes #844

@rjrjr rjrjr force-pushed the ray/let-it-show-let-it-show-let-it-show branch 2 times, most recently from f9ebc90 to 7b5d2f5 Compare July 28, 2022 21:14
@rjrjr rjrjr force-pushed the ray/back-button-always-the-back-button-what-a-terrible-idea-the-back-button-was branch 2 times, most recently from 2120968 to ba43dab Compare July 28, 2022 21:48
@rjrjr rjrjr force-pushed the ray/let-it-show-let-it-show-let-it-show branch 2 times, most recently from e57f231 to f6c0181 Compare July 28, 2022 21:56
@rjrjr rjrjr marked this pull request as ready for review July 28, 2022 22:30
@rjrjr rjrjr requested review from a team and zach-klippenstein as code owners July 28, 2022 22:30
@rjrjr rjrjr requested a review from JoelBryceAnderson July 28, 2022 22:31
Base automatically changed from ray/back-button-always-the-back-button-what-a-terrible-idea-the-back-button-was to main July 28, 2022 23:39
@WorkflowUiExperimentalApi
public var View.screen: Screen
get() = checkNotNull(screenOrNull) {
"Expected to find a Screen in tag workflow_screen (${R.id.workflow_screen})"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${R.id.workflow_screen} will render to some integer that won't make sense to users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I guess it won't be useful. I was figuring that by providing the name as well I was giving a hint that they could look for the magic number on other views or something.

@WorkflowUiExperimentalApi
public var Dialog.overlay: Overlay
get() = checkNotNull(overlayOrNull) {
"Expected to find an Overlay in tag workflow_overlay (${R.id.workflow_overlay}) " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same thing about integer value of the tag.

Using the `ViewEnvironment` to hold the current `Screen` and `Overlay` was conceptually very clean, but was bad for performance in Compose, which would recompose too often when a new `ViewEnvironment` was not equal to the previous one -- all due to `Showing` being updated. We now store the canonical `Screen` rendering for each `View` in a tag, and the `Overlay` for each `Dialog` in a tag on its decorView.

Fixes #844
@rjrjr rjrjr force-pushed the ray/let-it-show-let-it-show-let-it-show branch from f6c0181 to 98ebcbd Compare July 29, 2022 00:08

/**
* Returns the most recent [Overlay] rendering [shown][OverlayDialogHolder.show] in this [Dialog],
* or throws a [NullPointerException] ` if the receiver was not created via
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* or throws a [NullPointerException] ` if the receiver was not created via
* or throws a [NullPointerException] if the receiver was not created via

@rjrjr rjrjr merged commit b06b437 into main Jul 29, 2022
@rjrjr rjrjr deleted the ray/let-it-show-let-it-show-let-it-show branch July 29, 2022 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Showing is too volatile to live in ViewEnvironment
4 participants