mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Hotfix Android Crash on New User Installation
This commit is contained in:
@@ -187,6 +187,7 @@ public class Main extends AndroidApplication {
|
||||
|
||||
private void initForge(AndroidAdapter adapter, boolean permissiongranted){
|
||||
boolean isPortrait;
|
||||
if (permissiongranted){
|
||||
//establish assets directory
|
||||
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
|
||||
Gdx.app.error("Forge", "Can't access external storage");
|
||||
@@ -210,7 +211,10 @@ public class Main extends AndroidApplication {
|
||||
//enforce orientation based on whether device is a tablet and user preference
|
||||
adapter.switchOrientationFile = assetsDir + "switch_orientation.ini";
|
||||
boolean landscapeMode = adapter.isTablet == !FileUtil.doesFileExist(adapter.switchOrientationFile);
|
||||
if (permissiongranted){
|
||||
|
||||
ForgePreferences prefs = FModel.getPreferences();
|
||||
boolean propertyConfig = prefs != null && prefs.getPrefBoolean(ForgePreferences.FPref.UI_NETPLAY_COMPAT);
|
||||
|
||||
if (landscapeMode) {
|
||||
isPortrait = false;
|
||||
Main.this.setRequestedOrientation(Build.VERSION.SDK_INT >= 26 ?
|
||||
@@ -220,15 +224,15 @@ public class Main extends AndroidApplication {
|
||||
isPortrait = true;
|
||||
Main.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
|
||||
initialize(Forge.getApp(new AndroidClipboard(), adapter, assetsDir, propertyConfig, isPortrait));
|
||||
} else {
|
||||
isPortrait = true;
|
||||
//set current orientation
|
||||
Main.this.setRequestedOrientation(Main.this.getResources().getConfiguration().orientation);
|
||||
initialize(Forge.getApp(new AndroidClipboard(), adapter, "", false, isPortrait));
|
||||
}
|
||||
|
||||
ForgePreferences prefs = FModel.getPreferences();
|
||||
boolean propertyConfig = prefs != null && prefs.getPrefBoolean(ForgePreferences.FPref.UI_NETPLAY_COMPAT);
|
||||
initialize(Forge.getApp(new AndroidClipboard(), adapter, assetsDir, propertyConfig, isPortrait));
|
||||
}
|
||||
|
||||
/*@Override
|
||||
|
||||
Reference in New Issue
Block a user