Network Improvements

This commit is contained in:
Anthony Calosa
2020-04-13 15:42:56 +08:00
parent fdd009908d
commit d6c5d7f04d
25 changed files with 146 additions and 91 deletions

View File

@@ -39,6 +39,7 @@
-keep class com.google.common.** { *; }
-keep class io.sentry.event.Event { *; }
-keep class io.netty.util.internal.logging.** { *; }
-keep class net.jpountz.** { *; }
-keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* {
<init>(com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration);

View File

@@ -186,6 +186,7 @@ public class Main extends AndroidApplication {
}
private void initForge(AndroidAdapter adapter, boolean permissiongranted){
boolean isPortrait;
//establish assets directory
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
Gdx.app.error("Forge", "Can't access external storage");
@@ -211,20 +212,23 @@ public class Main extends AndroidApplication {
boolean landscapeMode = adapter.isTablet == !FileUtil.doesFileExist(adapter.switchOrientationFile);
if (permissiongranted){
if (landscapeMode) {
isPortrait = false;
Main.this.setRequestedOrientation(Build.VERSION.SDK_INT >= 26 ?
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : //Oreo and above has virtual back/menu buttons
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else {
isPortrait = true;
Main.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
} else {
isPortrait = true;
//set current orientation
Main.this.setRequestedOrientation(Main.this.getResources().getConfiguration().orientation);
}
ForgePreferences prefs = FModel.getPreferences();
boolean propertyConfig = prefs != null && prefs.getPrefBoolean(ForgePreferences.FPref.UI_NETPLAY_COMPAT);
initialize(Forge.getApp(new AndroidClipboard(), adapter, assetsDir, propertyConfig));
initialize(Forge.getApp(new AndroidClipboard(), adapter, assetsDir, propertyConfig, isPortrait));
}
/*@Override