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.
experimental
iwgeric 10 years ago
parent be6416b736
commit 664dfc037c
  1. 29
      sdk/jme3-android/src/com/jme3/gde/android/AndroidSdkTool.java

@ -299,17 +299,15 @@ public class AndroidSdkTool {
changed = true; changed = true;
} }
} }
// add the following after AndroidHarness.screenOrientation is depreciated if (sdkActivity != null) {
// for jME 3.1 if (sdkActivity.hasAttribute("android:screenOrientation")) {
// if (sdkActivity != null) { String attrScreenOrientation = sdkActivity.getAttribute("android:screenOrientation");
// if (sdkActivity.hasAttribute("android:screenOrientation")) { } else {
// String attrScreenOrientation = sdkActivity.getAttribute("android:screenOrientation"); Logger.getLogger(AndroidSdkTool.class.getName()).log(Level.INFO, "creating attrScreenOrientation");
// } else { sdkActivity.setAttribute("android:screenOrientation", "landscape");
// Logger.getLogger(AndroidSdkTool.class.getName()).log(Level.INFO, "creating attrScreenOrientation"); changed = true;
// sdkActivity.setAttribute("android:screenOrientation", "landscape"); }
// changed = true; }
// }
// }
} }
Element sdkElement = XmlHelper.findChildElement(configuration.getDocumentElement(), "uses-sdk"); Element sdkElement = XmlHelper.findChildElement(configuration.getDocumentElement(), "uses-sdk");
@ -319,7 +317,7 @@ public class AndroidSdkTool {
changed = true; changed = true;
} }
if (!"8".equals(sdkElement.getAttribute("android:minSdkVersion"))) { if (!"8".equals(sdkElement.getAttribute("android:minSdkVersion"))) {
sdkElement.setAttribute("android:minSdkVersion", "8"); sdkElement.setAttribute("android:minSdkVersion", "9");
changed = true; changed = true;
} }
Element screensElement = XmlHelper.findChildElement(configuration.getDocumentElement(), "supports-screens"); Element screensElement = XmlHelper.findChildElement(configuration.getDocumentElement(), "supports-screens");
@ -419,7 +417,6 @@ public class AndroidSdkTool {
+ " \n" + " \n"
+ "import android.content.pm.ActivityInfo;\n" + "import android.content.pm.ActivityInfo;\n"
+ "import com.jme3.app.AndroidHarness;\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.Level;\n"
+ "import java.util.logging.LogManager;\n" + "import java.util.logging.LogManager;\n"
+ " \n" + " \n"
@ -435,15 +432,9 @@ public class AndroidSdkTool {
+ " public MainActivity(){\n" + " public MainActivity(){\n"
+ " // Set the application class to run\n" + " // Set the application class to run\n"
+ " appClass = \"" + mainClass + "\";\n" + " appClass = \"" + mainClass + "\";\n"
+ " // Try ConfigType.FASTEST; or ConfigType.LEGACY if you have problems\n"
+ " eglConfigType = ConfigType.BEST;\n"
+ " // Exit Dialog title & message\n" + " // Exit Dialog title & message\n"
+ " exitDialogTitle = \"Exit?\";\n" + " exitDialogTitle = \"Exit?\";\n"
+ " exitDialogMessage = \"Press Yes\";\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" + " // Enable MouseEvents being generated from TouchEvents (default = true)\n"
+ " mouseEventsEnabled = true;\n" + " mouseEventsEnabled = true;\n"
+ " // Set the default logging level (default=Level.INFO, Level.ALL=All Debug Info)\n" + " // Set the default logging level (default=Level.INFO, Level.ALL=All Debug Info)\n"

Loading…
Cancel
Save