Skip to content

Conversation

@rjrjr
Copy link
Collaborator

@rjrjr rjrjr commented Mar 10, 2023

Note that I've cherry picked #969 here. No changes have been made to the existing tests or espresso support.

Introduces a new sample app, fixes some bugs it revealed, doesn't fix the major bug (#966) it was written to reproduce.

Nested overlays sample uses overlays.

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.

Fixes some Dialog handling problems revealed by Nested Overlays sample

  • 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.

NestedOverlays.webm

@rjrjr rjrjr requested review from a team and zach-klippenstein as code owners March 10, 2023 23:24
@rjrjr rjrjr marked this pull request as draft March 11, 2023 00:08
@rjrjr rjrjr force-pushed the ray/nested-overlays branch 4 times, most recently from bbc464c to ae4b4d3 Compare March 14, 2023 19:59
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.
@rjrjr rjrjr force-pushed the ray/nested-overlays branch from ae4b4d3 to a8d9a86 Compare March 14, 2023 20:13
- 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.
@rjrjr rjrjr force-pushed the ray/nested-overlays branch from a8d9a86 to e8811c6 Compare March 14, 2023 20:27
@rjrjr rjrjr marked this pull request as ready for review March 14, 2023 21:08
@rjrjr
Copy link
Collaborator Author

rjrjr commented Mar 14, 2023

samples:tictactoe:app:connectedDebugAndroidTest keeps failing. Is it really that flaky, or did I break it?

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.
@rjrjr
Copy link
Collaborator Author

rjrjr commented Mar 15, 2023

Note that I've cherry picked #969 here. No changes have been made to the existing tests or espresso support.

Copy link
Contributor

@steve-the-edwards steve-the-edwards left a comment

Choose a reason for hiding this comment

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

LGTM!

@rjrjr rjrjr merged commit dcc0e26 into ray/container Mar 16, 2023
@rjrjr rjrjr deleted the ray/nested-overlays branch March 16, 2023 17:39
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.

3 participants