v0.7.4b: fixed failing to launch in landscape on some android phones

This commit is contained in:
Evan Debenham 2019-08-05 13:24:19 -04:00
parent 489ea63752
commit c93bc9784b

View File

@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.android;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.opengl.GLSurfaceView;
import android.os.Build;
@ -59,6 +60,15 @@ public class AndroidLauncher extends AndroidApplication {
Game.versionCode = 0;
}
//set desired orientation (if it exists) before initializing the app.
if (getPreferences("ShatteredPixelDungeon").contains("landscape")) {
if (getPreferences("ShatteredPixelDungeon").getBoolean("landscape")){
instance.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
} else {
instance.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
}
}
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.depth = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {