android icon indicating copy to clipboard operation
android copied to clipboard

Fix full screen mode for all devices

Open dshokouhi opened this issue 2 years ago • 7 comments

Summary

Fixes: #2876 by using the recommended methods from Google, most likely these were updated after we had this code. Changed the theme to reflect for displays with cutouts too based on updated recommendation.

Tested on my pixel 6 pro by enabling the setting and also keeping the setting disabled and take a video into full screen. Also tested on an android 7 device to ensure the changes still work on older devices.

FWIW current code still continues to work on android 7 devices so this issue seems to impact newer version of android.

Screenshots

Link to pull request in Documentation repository

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

Any other notes

dshokouhi avatar Sep 13 '22 18:09 dshokouhi

Just a small feedback. Before:

image

After:

image

None of them are in full-screen. I think the previous one looks slightly better. The black bars are meant to hide the notch/cutout on OLED displays.

felipecrs avatar Sep 13 '22 21:09 felipecrs

@felipecrs did you test with the latest commit APK? I ended up reverting the theme changes in the latest commits

https://github.com/home-assistant/android/actions/runs/3048225313

dshokouhi avatar Sep 13 '22 21:09 dshokouhi

Oh yeah. The latest one looks fine. Thank you! My last feedback is:

~Do you think these CSS attributes have any effect while using the companion app? https://www.w3.org/TR/css-round-display-1/#viewport-fit-descriptor~

~I'm asking, because I wonder if we can code the Frigate Card in such a way that, when it requests full screen, it will before evaluate whether it's safe or not to draw over the cutout and disable drawing over the cutout if not safe (i.e. when there is a potential button that would be drawn over it).~

~If they are not effective for the use case I described above, I would suggest that the safest approach for the companion app, when requesting full-screen, would be not to draw over the cutout since it does not know what are the contents that will be drawn on it.~

Never mind, I just realized that the new behavior is that it never draws on top of the notch. This is awesome!

https://user-images.githubusercontent.com/29582865/190012224-05dc7afc-098e-45a2-b3d3-03d4cb6e4258.mp4

felipecrs avatar Sep 13 '22 21:09 felipecrs

Do you think these CSS attributes have any effect while using the companion app? https://www.w3.org/TR/css-round-display-1/#viewport-fit-descriptor

Anything that works in Chrome for Android should in theory work for the companion app as it uses Android System WebView which is based on Chromium.

The Companion App also offers a setting to enable Remote Debugging so you can inspect things like easier.

dshokouhi avatar Sep 13 '22 21:09 dshokouhi

Anything that works in Chrome for Android should in theory work for the companion app as it uses Android System WebView which is based on Chromium.

Ok, just to mention, they now behave a little differently from each other:

https://user-images.githubusercontent.com/29582865/190012577-5dea5d19-47f6-4944-8203-0ce4d759c637.mp4

The Android app never displays on top of the notch, while Chrome does. Which for me is completely okay (I prefer that contents are not drawn on top of the notch), but I'm not sure if that was the intended behavior.

felipecrs avatar Sep 13 '22 21:09 felipecrs

~Do you think these CSS attributes have any effect while using the companion app? https://www.w3.org/TR/css-round-display-1/#viewport-fit-descriptor~

The @viewport tag has been deprecated for some time now and is no longer supported by the Android WebView. A modern alternative for what you're describing, safe-area-inset-* values, should be supported according to Google, but no one seems to be able to get them to work reliably (I've also personally tried and failed 😔).

jpelgrom avatar Sep 13 '22 21:09 jpelgrom

The Android app never displays on top of the notch, while Chrome does. Which for me is completely okay (I prefer that contents are not drawn on top of the notch), but I'm not sure if that was the intended behavior.

I think thats to be expected and ok, the new code now follows Google's own recommendation for immersive mode. I also agree its good not to do anything in the notch area.

dshokouhi avatar Sep 13 '22 21:09 dshokouhi