From 4f9bf8cc7f83f813dcc3252b2eb9f60dda6f3273 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 31 Aug 2025 23:34:56 -0400 Subject: [PATCH] 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 --- .../android/AndroidPlatformSupport.java | 9 ++++----- android/src/main/res/values-v28/style.xml | 2 +- build.gradle | 2 +- .../ui/changelist/v3_X_Changes.java | 3 ++- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java index 2af7888d8..72c0d10b9 100644 --- a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java +++ b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java @@ -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()); diff --git a/android/src/main/res/values-v28/style.xml b/android/src/main/res/values-v28/style.xml index 01e8bb7f8..935b8d344 100644 --- a/android/src/main/res/values-v28/style.xml +++ b/android/src/main/res/values-v28/style.xml @@ -3,7 +3,7 @@ \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1a46acbc1..f746b5537 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ allprojects { appName = 'Shattered Pixel Dungeon' appPackageName = 'com.shatteredpixel.shatteredpixeldungeon' - appVersionCode = 866 + appVersionCode = 867 appVersionName = '3.2.3' appJavaCompatibility = JavaVersion.VERSION_11 diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/changelist/v3_X_Changes.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/changelist/v3_X_Changes.java index 7889dc91e..78e6e9130 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/changelist/v3_X_Changes.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/changelist/v3_X_Changes.java @@ -108,7 +108,8 @@ public class v3_X_Changes { "Fixed the following bugs:\n" + "**Caused by v3.2.2:**\n" + "**-** Windowed mode on desktop always defaulting to 1920x1080, instead of last window size\n" + - "**-** Various rare Android crashes caused by internal library updates")); + "**-** Various rare Android crashes caused by internal library updates\n" + + "**-** Fullscreen being incorrectly forced off on some older Android devices.")); changes = new ChangeInfo("v3.2.2", false, null); changes.hardlight(Window.TITLE_COLOR);