v0.6.0: cleaned up android SDK version references

This commit is contained in:
Evan Debenham
2017-03-04 03:12:14 -05:00
parent a58071f688
commit c64a468db5
4 changed files with 8 additions and 6 deletions

View File

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

View File

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

View File

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

View File

@@ -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")){