From 664dfc037cd84594f1e3506044af2d000fad69e6 Mon Sep 17 00:00:00 2001 From: iwgeric Date: Thu, 2 Apr 2015 13:14:16 -0400 Subject: [PATCH] SDK: Update creation of MainActivity and AndroidManifest to support jME 3.1 Add screen orientation to manifest and update the min version to 9. Update MainActivity creation to remove references to properties removed from AndroidHarness. --- .../com/jme3/gde/android/AndroidSdkTool.java | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/sdk/jme3-android/src/com/jme3/gde/android/AndroidSdkTool.java b/sdk/jme3-android/src/com/jme3/gde/android/AndroidSdkTool.java index b93b089cc..066265e74 100644 --- a/sdk/jme3-android/src/com/jme3/gde/android/AndroidSdkTool.java +++ b/sdk/jme3-android/src/com/jme3/gde/android/AndroidSdkTool.java @@ -299,17 +299,15 @@ public class AndroidSdkTool { changed = true; } } - // add the following after AndroidHarness.screenOrientation is depreciated - // for jME 3.1 -// if (sdkActivity != null) { -// if (sdkActivity.hasAttribute("android:screenOrientation")) { -// String attrScreenOrientation = sdkActivity.getAttribute("android:screenOrientation"); -// } else { -// Logger.getLogger(AndroidSdkTool.class.getName()).log(Level.INFO, "creating attrScreenOrientation"); -// sdkActivity.setAttribute("android:screenOrientation", "landscape"); -// changed = true; -// } -// } + if (sdkActivity != null) { + if (sdkActivity.hasAttribute("android:screenOrientation")) { + String attrScreenOrientation = sdkActivity.getAttribute("android:screenOrientation"); + } else { + Logger.getLogger(AndroidSdkTool.class.getName()).log(Level.INFO, "creating attrScreenOrientation"); + sdkActivity.setAttribute("android:screenOrientation", "landscape"); + changed = true; + } + } } Element sdkElement = XmlHelper.findChildElement(configuration.getDocumentElement(), "uses-sdk"); @@ -319,7 +317,7 @@ public class AndroidSdkTool { changed = true; } if (!"8".equals(sdkElement.getAttribute("android:minSdkVersion"))) { - sdkElement.setAttribute("android:minSdkVersion", "8"); + sdkElement.setAttribute("android:minSdkVersion", "9"); changed = true; } Element screensElement = XmlHelper.findChildElement(configuration.getDocumentElement(), "supports-screens"); @@ -419,7 +417,6 @@ public class AndroidSdkTool { + " \n" + "import android.content.pm.ActivityInfo;\n" + "import com.jme3.app.AndroidHarness;\n" - + "import com.jme3.system.android.AndroidConfigChooser.ConfigType;\n" + "import java.util.logging.Level;\n" + "import java.util.logging.LogManager;\n" + " \n" @@ -435,15 +432,9 @@ public class AndroidSdkTool { + " public MainActivity(){\n" + " // Set the application class to run\n" + " appClass = \"" + mainClass + "\";\n" - + " // Try ConfigType.FASTEST; or ConfigType.LEGACY if you have problems\n" - + " eglConfigType = ConfigType.BEST;\n" + " // Exit Dialog title & message\n" + " exitDialogTitle = \"Exit?\";\n" + " exitDialogMessage = \"Press Yes\";\n" - + " // Enable verbose logging\n" - + " eglConfigVerboseLogging = false;\n" - + " // Choose screen orientation\n" - + " screenOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;\n" + " // Enable MouseEvents being generated from TouchEvents (default = true)\n" + " mouseEventsEnabled = true;\n" + " // Set the default logging level (default=Level.INFO, Level.ALL=All Debug Info)\n"