-
Notifications
You must be signed in to change notification settings - Fork 101
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
4/4 asDialogHolderWithContent
, ScreenViewHolder.startShowing
#1031
4/4 asDialogHolderWithContent
, ScreenViewHolder.startShowing
#1031
Conversation
setContent
to asDialogHolderWithContent
, turnOffChrome
setContent
to asDialogHolderWithContent
, turnOffChrome
3b0b714
to
ccc0bb0
Compare
.../core-android/src/main/java/com/squareup/workflow1/ui/container/AsDialogHolderWithContent.kt
Show resolved
Hide resolved
.../core-android/src/main/java/com/squareup/workflow1/ui/container/AsDialogHolderWithContent.kt
Outdated
Show resolved
Hide resolved
Btw - I don't remember seeing naming update in the deprecation warning strings. Need to add that. |
bb48afd
to
af3caaf
Compare
c8d713d
to
10b1c37
Compare
setContent
to asDialogHolderWithContent
, turnOffChrome
asDialogHolderWithContent
, ScreenViewHolder.startShowing
6568f63
to
eebc089
Compare
@steve-the-edwards Good morning! I've smoked and canaried the heck out of this, and it's ready to go. The three upstream PRs haven't changed since you reviewed them, but this one could definitely use a new review. Be sure to check ignore whitespace! |
af3caaf
to
eb3de9c
Compare
eebc089
to
f686c15
Compare
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.
LGTM! 2 nits/typos.
workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/ScreenViewFactory.kt
Outdated
Show resolved
Hide resolved
...ow-ui/core-android/src/main/java/com/squareup/workflow1/ui/container/OverlayDialogFactory.kt
Outdated
Show resolved
Hide resolved
* +----+=============+------+ | ||
* | My| | | | ||
* | | MyEditModal | | | ||
* | | | | | ||
* +----+=============+------+ | ||
* | MyTutorialScreen | | ||
* +-------------------------+ |
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.
😮 . ASCII diagram skills. 🔥
* Whatever structure you settle on for your root rendering, it is important | ||
* to render the same structure every time. If your app will ever want to show | ||
* an [Overlay], it should always render [BodyAndOverlaysScreen], even when | ||
* there is no [Overlay] to show. Otherwise your entire view tree will be rebuilt, | ||
* since the view built for a `MyBodyAndBottomBarScreen` cannot be updated to show | ||
* a [BodyAndOverlaysScreen] rendering. |
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.
Nice recent addition :)
1. `setContent` as a method name gave no clue that we were returning a new manager object, so now it's called `asDialogHolderWithContent` 2. Hard coding the call to `Dialog.setContent` interferes with code that needs to make that call itself. We now accept a `setContent: (ScreenViewHolder<C>) -> Unit` lambda to do that work, which defaults to the current behavior. 3. Decouple building and starting views. This allows us to ensure that a Dialog's content view is attached to its window before its first rendering -- before the first call to `ScreenViewHolder.show`. Necessary to ensure that the strictly view-tree-based AndroidX `findViewTreeOnBackPressedDispatcherOwner()` call works immediately. This was always the original intention, but never actually found a use case until now. 4. Moves most of that default behavior to a public `Dialog.fixBackgroundAndDimming` extension function to keep it available and more self documenting (hard learned lessons in there). Pretty similar to how `ScreenOverlayDialogFactory` acts. 5. Big kdoc update
f686c15
to
834da85
Compare
Hide whitespace while reviewing this, especially in
ScreenViewFactory.kt
.setContent
as a method name gave no clue that we were returning a new manager object, so now it's calledasDialogHolderWithContent
Hard coding the call to
Dialog.setContent
interferes with code that needs to make that call itself. We now accept asetContent: (ScreenViewHolder<C>) -> Unit
lambda to do that work, which defaults to the current behavior.Decouple building and starting views. This allows us to ensure that a Dialog's content view is attached to its window before its first rendering -- before the first call to
ScreenViewHolder.show
. Necessary to ensure that the strictly view-tree-based AndroidXfindViewTreeOnBackPressedDispatcherOwner()
call works immediately. This was always the original intention, but never actually found a use case until now.Moves most of that default behavior to a public
Dialog.fixBackgroundAndDimming
extension function to keep it available and more self documenting (hard learned lessons in there). Pretty similar to howScreenOverlayDialogFactory
acts.Big kdoc update