Add support for custom view in FrontendScreen#6790
Merged
Conversation
48 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for rendering a WebView-provided “custom view” (typically fullscreen HTML5 video) inside the Compose-based FrontendScreen, building on the earlier ExoPlayer overlay work.
Changes:
- Extend
HAWebChromeClientwithonShowCustomView/onHideCustomViewcallbacks - Add
customViewtoFrontendViewState.Contentand propagate it fromFrontendViewModel - Render the custom view as a fullscreen Compose overlay in
FrontendScreen, with unit/UI/screenshot test coverage
Reviewed changes
Copilot reviewed 8 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/kotlin/io/homeassistant/companion/android/util/HAWebChromeClient.kt | Adds custom view show/hide callbacks to WebChromeClient wrapper |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendViewState.kt | Adds customView: View? to FrontendViewState.Content |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendViewModel.kt | Wires WebChromeClient callbacks to state updates + fullscreen events |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendScreen.kt | Displays a fullscreen overlay for customView and adds a test tag |
| app/src/test/kotlin/io/homeassistant/companion/android/util/HAWebChromeClientTest.kt | Unit tests for forwarding show/hide custom view callbacks |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/FrontendViewModelTest.kt | Unit tests for ViewModel state changes + fullscreen events on custom view |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/FrontendScreenTest.kt | Compose UI tests asserting the overlay is shown/hidden based on state |
| app/src/screenshotTest/kotlin/io/homeassistant/companion/android/frontend/FrontendScreenScreenshotTest.kt | Adds screenshot test coverage for the custom view overlay |
| app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/frontend/FrontendScreenScreenshotTest/FrontendScreen Content state with custom view overlay_tablet_landscape_62cae397_0.png | Screenshot baseline for tablet landscape |
| app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/frontend/FrontendScreenScreenshotTest/FrontendScreen Content state with custom view overlay_tablet_2f22c4ea_0.png | Screenshot baseline for tablet |
| app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/frontend/FrontendScreenScreenshotTest/FrontendScreen Content state with custom view overlay_small_phone_66e7bbf2_0.png | Screenshot baseline for small phone |
| app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/frontend/FrontendScreenScreenshotTest/FrontendScreen Content state with custom view overlay_phone_landscape_9e00b29d_0.png | Screenshot baseline for phone landscape |
| app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/frontend/FrontendScreenScreenshotTest/FrontendScreen Content state with custom view overlay_phone_e05166be_0.png | Screenshot baseline for phone |
| app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/frontend/FrontendScreenScreenshotTest/FrontendScreen Content state with custom view overlay_foldable_c908f502_0.png | Screenshot baseline for foldable |
0830f90 to
5a83e3d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for WebView “custom views” (typically fullscreen HTML5 video views provided via WebChromeClient.onShowCustomView) to the Compose-based FrontendScreen, building on the earlier FrontendScreen ExoPlayer overlay work.
Changes:
- Extend
HAWebChromeClientwithonShowCustomView/onHideCustomViewcallbacks and add unit tests for them - Add a
customViewoverlay toFrontendScreenContentusingAndroidView, with Compose UI tests + screenshot test coverage - Refactor
FrontendViewModelto provide acreateWebChromeClient(...)factory so the custom view can stay UI-scoped (avoiding ViewModel leaks) while still emitting fullscreen events
Reviewed changes
Copilot reviewed 7 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/kotlin/io/homeassistant/companion/android/util/HAWebChromeClient.kt | Adds forwarding for WebView custom view show/hide callbacks |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendViewModel.kt | Introduces createWebChromeClient(...) to wire fullscreen + permission/JS confirm handling without storing Views in VM state |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendScreen.kt | Adds UI-scoped customView state and renders it as a fullscreen overlay via AndroidView |
| app/src/test/kotlin/io/homeassistant/companion/android/util/HAWebChromeClientTest.kt | Adds unit tests for custom view callbacks |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/FrontendViewModelTest.kt | Adds tests ensuring custom view callbacks + fullscreen events are emitted via the factory client |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/FrontendScreenTest.kt | Adds Compose UI tests verifying the overlay appears/doesn’t appear based on customView |
| app/src/screenshotTest/kotlin/io/homeassistant/companion/android/frontend/FrontendScreenScreenshotTest.kt | Adds screenshot coverage for the custom view overlay |
| app/src/screenshotTestFullDebug/reference/...png | Adds reference images for the new screenshot test |
383f8e1 to
560a6f8
Compare
636dd8d to
fc46f0d
Compare
560a6f8 to
86d11f1
Compare
jpelgrom
reviewed
May 4, 2026
86d11f1 to
0246987
Compare
4 tasks
jpelgrom
approved these changes
May 5, 2026
Instanciate the HAWebChromeClient from Compose to get the custom view
7dff587 to
a4fa47f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for custom view coming from the
WebViewinto theFrontendScreen. It is built on top of the ExoPlayer support PR #6771.Checklist