From c64a468db58314597b67336f23b3bbe008922fe9 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 4 Mar 2017 03:12:14 -0500 Subject: [PATCH] v0.6.0: cleaned up android SDK version references --- SPD-classes/src/main/java/com/watabou/noosa/Game.java | 2 +- .../shatteredpixeldungeon/ShatteredPixelDungeon.java | 6 +++--- .../shatteredpixeldungeon/messages/Messages.java | 2 +- .../shatteredpixeldungeon/windows/WndSettings.java | 4 +++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/SPD-classes/src/main/java/com/watabou/noosa/Game.java b/SPD-classes/src/main/java/com/watabou/noosa/Game.java index 0b630aa60..3fb604dfb 100644 --- a/SPD-classes/src/main/java/com/watabou/noosa/Game.java +++ b/SPD-classes/src/main/java/com/watabou/noosa/Game.java @@ -132,7 +132,7 @@ public class Game extends Activity implements GLSurfaceView.Renderer, View.OnTou view = new GLSurfaceView( this ); view.setEGLContextClientVersion( 2 ); - //Versions of android below 4.0.0 are forced to RGB 565 for performance reasons. + //Versions of android below 4.1 are forced to RGB 565 for performance reasons. //Otherwise try to use RGB888 for best quality, but use RGB565 if it is what's available. view.setEGLConfigChooser( new ScreenConfigChooser( Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN, diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index 73cdd9e82..4d198ec44 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -186,7 +186,7 @@ public class ShatteredPixelDungeon extends Game { } else { DisplayMetrics metrics = new DisplayMetrics(); - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) getWindowManager().getDefaultDisplay().getRealMetrics( metrics ); else getWindowManager().getDefaultDisplay().getMetrics( metrics ); @@ -280,7 +280,7 @@ public class ShatteredPixelDungeon extends Game { */ public static void landscape( boolean value ) { - if (android.os.Build.VERSION.SDK_INT >= 9) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { Game.instance.setRequestedOrientation(value ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); @@ -382,7 +382,7 @@ public class ShatteredPixelDungeon extends Game { } public static void updateImmersiveMode() { - if (android.os.Build.VERSION.SDK_INT >= 19) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { try { // Sometime NullPointerException happens here instance.getWindow().getDecorView().setSystemUiVisibility( diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java index 4789bf29e..cc29e7f8d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java @@ -87,7 +87,7 @@ public class Messages { String value = bundle.getString(key); //android 2.2 doesn't use UTF-8 by default, need to force it. - if (android.os.Build.VERSION.SDK_INT == 8) { + if (android.os.Build.VERSION.SDK_INT == android.os.Build.VERSION_CODES.FROYO) { try { value = new String(value.getBytes("ISO-8859-1"), "UTF-8"); } catch (Exception e) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java index 891e2ee3a..8fc8ae23c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java @@ -21,6 +21,8 @@ package com.shatteredpixel.shatteredpixeldungeon.windows; +import android.os.Build; + import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -285,7 +287,7 @@ public class WndSettings extends WndTabbed { }; chkImmersive.setRect( 0, slots.bottom() + GAP_SML, WIDTH, BTN_HEIGHT ); chkImmersive.checked(ShatteredPixelDungeon.immersed()); - chkImmersive.enable(android.os.Build.VERSION.SDK_INT >= 19); + chkImmersive.enable(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1); add(chkImmersive); CheckBox chkFont = new CheckBox(Messages.get(this, "system_font")){