Skip to content

Edge to edge support for webviews using <View> bars #5390

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Gregman-js
Copy link

Summary

  • Enable enableEdgeToEdge() for all
  • Changing active server supported (tested by changing server in settings)
  • Add <View> on top and bottom of <Webview>
  • Control above views height with InsetsUtil.kt
if (!serverHandleInsets) {
    statusBarBackground?.updateLayoutParams {
        height = safeInsets.top
    }
    navigationBarBackground?.updateLayoutParams {
        height = safeInsets.bottom
    }
} else {
// evaluateJavascript...
}
  • Support new and old status bar apis
    Android >= 15 will use Views background color
    Android < 15 will use Views background colors and statusBarColor on top
if (statusBarColor != 0 && !serverHandleInsets) {
    window.statusBarColor = statusBarColor
    binding.statusBarBackground.setBackgroundColor(statusBarColor)
} else {
    Timber.e("Skipping coloring status bar...")
}
if (navigationBarColor != 0 && !serverHandleInsets) {
    window.navigationBarColor = navigationBarColor
    binding.navigationBarBackground.setBackgroundColor(navigationBarColor)
} else {
    Timber.e("Skipping coloring navigation bar...")
}

Checklist

  • New or updated tests have been added to cover the changes following the testing guidelines.
  • The code follows the project's code style and best_practices.
  • The changes have been thoroughly tested, and edge cases have been considered.
  • Changes are backward compatible whenever feasible. Any breaking changes are documented in the changelog for users and/or in the code for developers depending on the relevance.

Screenshots

Link to pull request in documentation repositories

User Documentation: home-assistant/companion.home-assistant#

Developer Documentation: home-assistant/developers.home-assistant#

Any other notes

@TimoPtr
Copy link
Collaborator

TimoPtr commented Jun 10, 2025

@Gregman-js I'm working on migrating the webViews to compose so that we can handle this into one place.

@TimoPtr
Copy link
Collaborator

TimoPtr commented Jun 17, 2025

@Gregman-js here is the PR #5419 for the migration to Compose. It will be easier to apply your fix in compose and it will work for the other screens too.

You are more than welcome to review the PR :)

@Gregman-js Gregman-js force-pushed the feature/edge-to-edge-webviews-bars branch from 37c8344 to 2e73d2b Compare June 19, 2025 22:58
@TimoPtr
Copy link
Collaborator

TimoPtr commented Jun 24, 2025

@Gregman-js The PR about compose has been merged. Could you impl your proposal in compose only and apply it to the two places that uses a WebView. FYI we can't get the version of a server without being fully authenticated so in the onboarding we cannot assume that the frontend support edge to edge yet.

@Gregman-js Gregman-js changed the base branch from feature/edge-to-edge-webviews to main June 24, 2025 21:34
@TimoPtr
Copy link
Collaborator

TimoPtr commented Jun 25, 2025

It seems that in some case we have the capability to get the version of the server through mDNS

Then it won't work for ppl that set the address manually. But it would cover most of the case which is nice.

It's important because sometimes the users are making the setup of their home assistant instances directly on their phone so we want to make sure that edge to edge is properly handled to not hide anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants