v3.2.2: Increased minimum Android to 5.0 from 4.0, and Java from 8 to 11

This commit is contained in:
Evan Debenham
2025-08-17 10:52:27 -04:00
parent 797f2791a4
commit 83535d9723
6 changed files with 21 additions and 53 deletions

View File

@@ -30,7 +30,6 @@ import com.badlogic.gdx.controllers.ControllerMapping;
import com.badlogic.gdx.controllers.Controllers;
import com.watabou.noosa.Game;
import com.watabou.noosa.ui.Cursor;
import com.watabou.utils.DeviceCompat;
import com.watabou.utils.PointF;
public class ControllerHandler implements ControllerListener {
@@ -65,9 +64,7 @@ public class ControllerHandler implements ControllerListener {
private static boolean failedInit = false;
public static boolean controllersSupported() {
if (DeviceCompat.isAndroid() && Gdx.app.getVersion() < 16) {
return false;
} else if (failedInit) {
if (failedInit) {
return false;
} else if (initialized){
return true;

View File

@@ -32,14 +32,15 @@ public class DeviceCompat {
public static boolean supportsFullScreen(){
switch (Gdx.app.getType()){
case Android:
//Android 4.4+ supports hiding UI via immersive mode
return Gdx.app.getVersion() >= 19;
//TODO perhaps have this vary based on status bar type?
return true;
case iOS:
//iOS supports hiding UI via drawing into the gesture safe area
return Gdx.graphics.getSafeInsetBottom() != 0;
default:
//TODO implement functionality for other platforms here
case Desktop:
return true;
default:
return false;
}
}

View File

@@ -12,9 +12,6 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- We perform a runtime check to ensure controllers are disabled on API 14 & 15 -->
<uses-sdk tools:overrideLibrary="com.badlogicgames.gdx.controllers" />
<!-- Note that the game doesn't truly support small screen resolutions,
it instead forces downscaling to work on these displays.-->
<supports-screens

View File

@@ -131,12 +131,6 @@ public class AndroidLauncher extends AndroidApplication {
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.depth = 0;
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
//use rgb565 on ICS devices for better performance
config.r = 5;
config.g = 6;
config.b = 5;
}
//we manage this ourselves
config.useImmersiveMode = false;
@@ -164,11 +158,7 @@ public class AndroidLauncher extends AndroidApplication {
protected void onResume() {
//prevents weird rare cases where the app is running twice
if (instance != this){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
finishAndRemoveTask();
} else {
finish();
}
finishAndRemoveTask();
}
super.onResume();
}

View File

@@ -25,7 +25,6 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.opengl.GLSurfaceView;
import android.os.Build;
import android.view.View;
@@ -77,10 +76,6 @@ public class AndroidPlatformSupport extends PlatformSupport {
float renderWidth = dispRatio > 1 ? PixelScene.MIN_WIDTH_L : PixelScene.MIN_WIDTH_P;
float renderHeight = dispRatio > 1 ? PixelScene.MIN_HEIGHT_L : PixelScene.MIN_HEIGHT_P;
//force power saver in this case as all devices must run at at least 2x scale.
if (Game.dispWidth < renderWidth*2 || Game.dispHeight < renderHeight*2)
SPDSettings.put( SPDSettings.KEY_POWER_SAVER, true );
if (SPDSettings.powerSaver() && fullscreen){
int maxZoom = (int)Math.min(Game.dispWidth/renderWidth, Game.dispHeight/renderHeight);
@@ -132,17 +127,16 @@ public class AndroidPlatformSupport extends PlatformSupport {
AndroidLauncher.instance.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
if (SPDSettings.fullscreen()) {
AndroidLauncher.instance.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY );
} else {
AndroidLauncher.instance.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE );
}
//TODO can immersive be handled by libGDX? It's getting quite dated here
if (SPDSettings.fullscreen()) {
AndroidLauncher.instance.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY );
} else {
AndroidLauncher.instance.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE );
}
}
});
@@ -150,20 +144,9 @@ public class AndroidPlatformSupport extends PlatformSupport {
}
@Override
@SuppressWarnings("deprecation")
public boolean connectedToUnmeteredNetwork() {
//Returns true if using unmetered connection, use shortcut method if available
ConnectivityManager cm = (ConnectivityManager) AndroidLauncher.instance.getSystemService(Context.CONNECTIVITY_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
return !cm.isActiveNetworkMetered();
} else {
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
return activeNetwork != null && activeNetwork.isConnectedOrConnecting() &&
(activeNetwork.getType() == ConnectivityManager.TYPE_WIFI
|| activeNetwork.getType() == ConnectivityManager.TYPE_WIMAX
|| activeNetwork.getType() == ConnectivityManager.TYPE_BLUETOOTH
|| activeNetwork.getType() == ConnectivityManager.TYPE_ETHERNET);
}
//Returns true if using unmetered connection
return !((ConnectivityManager) AndroidLauncher.instance.getSystemService(Context.CONNECTIVITY_SERVICE)).isActiveNetworkMetered();
}
@Override

View File

@@ -17,10 +17,10 @@ allprojects {
appVersionCode = 861
appVersionName = '3.2.1'
appJavaCompatibility = JavaVersion.VERSION_1_8
appJavaCompatibility = JavaVersion.VERSION_11
appAndroidCompileSDK = 35 //Android 15
appAndroidMinSDK = 14 //Android 4.0
appAndroidMinSDK = 21 //Android 5.0
//significant layout management changes required for API 35+ as edge-to-edge is forced on
//will do this at the same time as dropping support for Android 4.4- (later in 2025)
appAndroidTargetSDK = 34 //Android 14