v3.2.2: Increased minimum Android to 5.0 from 4.0, and Java from 8 to 11
This commit is contained in:
@@ -30,7 +30,6 @@ import com.badlogic.gdx.controllers.ControllerMapping;
|
|||||||
import com.badlogic.gdx.controllers.Controllers;
|
import com.badlogic.gdx.controllers.Controllers;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
import com.watabou.noosa.ui.Cursor;
|
import com.watabou.noosa.ui.Cursor;
|
||||||
import com.watabou.utils.DeviceCompat;
|
|
||||||
import com.watabou.utils.PointF;
|
import com.watabou.utils.PointF;
|
||||||
|
|
||||||
public class ControllerHandler implements ControllerListener {
|
public class ControllerHandler implements ControllerListener {
|
||||||
@@ -65,9 +64,7 @@ public class ControllerHandler implements ControllerListener {
|
|||||||
private static boolean failedInit = false;
|
private static boolean failedInit = false;
|
||||||
|
|
||||||
public static boolean controllersSupported() {
|
public static boolean controllersSupported() {
|
||||||
if (DeviceCompat.isAndroid() && Gdx.app.getVersion() < 16) {
|
if (failedInit) {
|
||||||
return false;
|
|
||||||
} else if (failedInit) {
|
|
||||||
return false;
|
return false;
|
||||||
} else if (initialized){
|
} else if (initialized){
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -32,14 +32,15 @@ public class DeviceCompat {
|
|||||||
public static boolean supportsFullScreen(){
|
public static boolean supportsFullScreen(){
|
||||||
switch (Gdx.app.getType()){
|
switch (Gdx.app.getType()){
|
||||||
case Android:
|
case Android:
|
||||||
//Android 4.4+ supports hiding UI via immersive mode
|
//TODO perhaps have this vary based on status bar type?
|
||||||
return Gdx.app.getVersion() >= 19;
|
return true;
|
||||||
case iOS:
|
case iOS:
|
||||||
//iOS supports hiding UI via drawing into the gesture safe area
|
//iOS supports hiding UI via drawing into the gesture safe area
|
||||||
return Gdx.graphics.getSafeInsetBottom() != 0;
|
return Gdx.graphics.getSafeInsetBottom() != 0;
|
||||||
default:
|
case Desktop:
|
||||||
//TODO implement functionality for other platforms here
|
|
||||||
return true;
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,6 @@
|
|||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<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,
|
<!-- Note that the game doesn't truly support small screen resolutions,
|
||||||
it instead forces downscaling to work on these displays.-->
|
it instead forces downscaling to work on these displays.-->
|
||||||
<supports-screens
|
<supports-screens
|
||||||
|
|||||||
@@ -131,12 +131,6 @@ public class AndroidLauncher extends AndroidApplication {
|
|||||||
|
|
||||||
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
||||||
config.depth = 0;
|
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
|
//we manage this ourselves
|
||||||
config.useImmersiveMode = false;
|
config.useImmersiveMode = false;
|
||||||
@@ -164,11 +158,7 @@ public class AndroidLauncher extends AndroidApplication {
|
|||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
//prevents weird rare cases where the app is running twice
|
//prevents weird rare cases where the app is running twice
|
||||||
if (instance != this){
|
if (instance != this){
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
finishAndRemoveTask();
|
finishAndRemoveTask();
|
||||||
} else {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import android.annotation.SuppressLint;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
|
||||||
import android.opengl.GLSurfaceView;
|
import android.opengl.GLSurfaceView;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.view.View;
|
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 renderWidth = dispRatio > 1 ? PixelScene.MIN_WIDTH_L : PixelScene.MIN_WIDTH_P;
|
||||||
float renderHeight = dispRatio > 1 ? PixelScene.MIN_HEIGHT_L : PixelScene.MIN_HEIGHT_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){
|
if (SPDSettings.powerSaver() && fullscreen){
|
||||||
|
|
||||||
int maxZoom = (int)Math.min(Game.dispWidth/renderWidth, Game.dispHeight/renderHeight);
|
int maxZoom = (int)Math.min(Game.dispWidth/renderWidth, Game.dispHeight/renderHeight);
|
||||||
@@ -133,7 +128,7 @@ public class AndroidPlatformSupport extends PlatformSupport {
|
|||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN | 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){
|
//TODO can immersive be handled by libGDX? It's getting quite dated here
|
||||||
if (SPDSettings.fullscreen()) {
|
if (SPDSettings.fullscreen()) {
|
||||||
AndroidLauncher.instance.getWindow().getDecorView().setSystemUiVisibility(
|
AndroidLauncher.instance.getWindow().getDecorView().setSystemUiVisibility(
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
@@ -144,26 +139,14 @@ public class AndroidPlatformSupport extends PlatformSupport {
|
|||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE );
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public boolean connectedToUnmeteredNetwork() {
|
public boolean connectedToUnmeteredNetwork() {
|
||||||
//Returns true if using unmetered connection, use shortcut method if available
|
//Returns true if using unmetered connection
|
||||||
ConnectivityManager cm = (ConnectivityManager) AndroidLauncher.instance.getSystemService(Context.CONNECTIVITY_SERVICE);
|
return !((ConnectivityManager) AndroidLauncher.instance.getSystemService(Context.CONNECTIVITY_SERVICE)).isActiveNetworkMetered();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ allprojects {
|
|||||||
appVersionCode = 861
|
appVersionCode = 861
|
||||||
appVersionName = '3.2.1'
|
appVersionName = '3.2.1'
|
||||||
|
|
||||||
appJavaCompatibility = JavaVersion.VERSION_1_8
|
appJavaCompatibility = JavaVersion.VERSION_11
|
||||||
|
|
||||||
appAndroidCompileSDK = 35 //Android 15
|
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
|
//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)
|
//will do this at the same time as dropping support for Android 4.4- (later in 2025)
|
||||||
appAndroidTargetSDK = 34 //Android 14
|
appAndroidTargetSDK = 34 //Android 14
|
||||||
|
|||||||
Reference in New Issue
Block a user