ClassiCube icon indicating copy to clipboard operation
ClassiCube copied to clipboard

Display cutout support

Open igor725 opened this issue 4 years ago • 6 comments

On Android devices with screen cutout (like camera punch-hole) the game does not render in the cutout area. I tried to solve this problem myself, but I am not a kickass android developer, so I couldn't. I tried to set window attribute LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES but the screen bounds didn't change from 2309x1080 to 2400x1080. Apparently I'm doing something wrong, but I don't know what.

Screenshot_2021-08-12-18-59-53-631_com_classicube_android_client WindowsTerminal_2021-08-12_19-13-02

igor725 avatar Aug 12 '21 16:08 igor725

This also goes for the launcher screen. and the device im using also has a camera punchhole Screenshot_20210812-131240

ProgramPL avatar Aug 12 '21 17:08 ProgramPL

Are you enabling it programmatically or via modifying AndroidManifest.xml?

UnknownShadow200 avatar Aug 13 '21 13:08 UnknownShadow200

Are you enabling it programmatically or via modifying AndroidManifest.xml?

Tried both. As described here.

igor725 avatar Aug 13 '21 14:08 igor725

Finally I got it. Thank goodness StackOverflow exists, lol. Here is the fixed unsigned apk.

igor725 avatar Aug 13 '21 21:08 igor725

@igor725

Unfortunately turns out that window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); also causes the onscreen keyboard to stop resizing the game view on modern android devices. e.g. when opening in-game chat on my Android 9 device, the onscreen keyboard draws over top of chat input now

I've tried some other flags, but was unsuccessful in getting both rendering over display cutout and onscreen keyboard resizing to work. The issue seems to be that flags that enable rendering over display cutout also mark the window as fullscreen. Unfortunately, the documentation for LayoutParams.SOFT_INPUT_ADJUST_RESIZE explicitly states that it has no effect with fullscreen windows

I've decided to revert rendering over display cutout support for now

UnknownShadow200 avatar Aug 29 '21 00:08 UnknownShadow200

Ummm... I think we can calculate the soft keyboard height somehow then move the input box to top of it.

igor725 avatar Sep 01 '21 08:09 igor725