v3.2.3: last minute Android fixes and re-upped version code for Android:
- fixed crashes on Android 9 and 10 by swapping to 'shortEdges' cutout mode ('always' cutout display mode wasn't present in these versions)
- upped fullscreen check to Android 9+, assume navbar exists in prior versions
- fixed navbar inset always being ignored in Android 9-14
This commit is contained in:
@@ -56,8 +56,9 @@ public class AndroidPlatformSupport extends PlatformSupport {
|
||||
}
|
||||
|
||||
public boolean supportsFullScreen(){
|
||||
//Android supports hiding the navigation bar or gesture bar, if it is present
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
//We support hiding the navigation bar or gesture bar, if it is present
|
||||
// on Android 9+ we check for this, on earlier just assume it's present
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
WindowInsets insets = AndroidLauncher.instance.getApplicationWindow().getDecorView().getRootWindowInsets();
|
||||
return insets != null && (insets.getStableInsetBottom() > 0 || insets.getStableInsetRight() > 0 || insets.getStableInsetLeft() > 0);
|
||||
} else {
|
||||
@@ -70,14 +71,12 @@ public class AndroidPlatformSupport extends PlatformSupport {
|
||||
RectF insets = new RectF();
|
||||
|
||||
//getting insets technically works down to 6.0 Marshmallow, but we let the device handle all of that prior to 9.0 Pie
|
||||
//TODO test on Android P emulator!
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && !AndroidLauncher.instance.isInMultiWindowMode()) {
|
||||
WindowInsets rootInsets = AndroidLauncher.instance.getApplicationWindow().getDecorView().getRootWindowInsets();
|
||||
if (rootInsets != null) {
|
||||
|
||||
//Navigation bar (never on the top)
|
||||
//Android 14 and below do this for us
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM && supportsFullScreen() && !SPDSettings.fullscreen()) {
|
||||
if (supportsFullScreen() && !SPDSettings.fullscreen()) {
|
||||
insets.left = Math.max(insets.left, rootInsets.getStableInsetLeft());
|
||||
insets.right = Math.max(insets.right, rootInsets.getStableInsetRight());
|
||||
insets.bottom = Math.max(insets.bottom, rootInsets.getStableInsetBottom());
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!-- Newer Material translucent theme for Android 9+ that lets them go true fullscreen -->
|
||||
<style name="GameTheme" parent="@android:style/Theme.Material.NoActionBar.TranslucentDecor">
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">
|
||||
always <!-- For Android 14- devices, edge-to-edge is automatic for Android 15+ -->
|
||||
shortEdges <!-- For Android 14- devices. Edge-to-edge is automatic for Android 15+ -->
|
||||
</item>
|
||||
</style>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user