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:
Evan Debenham
2025-08-31 23:34:56 -04:00
parent 861f28c465
commit 4f9bf8cc7f
4 changed files with 8 additions and 8 deletions

View File

@@ -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());

View File

@@ -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>

View File

@@ -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

View File

@@ -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);