diff --git a/jme3-android-examples/.gitignore b/jme3-android-examples/.gitignore
new file mode 100644
index 000000000..796b96d1c
--- /dev/null
+++ b/jme3-android-examples/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/jme3-android-examples/build.gradle b/jme3-android-examples/build.gradle
index f1ee38739..24b07b2e5 100644
--- a/jme3-android-examples/build.gradle
+++ b/jme3-android-examples/build.gradle
@@ -1,28 +1,18 @@
-dependencies {
- compile project(':jme3-core')
- compile project(':jme3-android')
- compile project(':jme3-effects')
- compile project(':jme3-bullet')
- compile project(':jme3-bullet-native-android')
- compile project(':jme3-networking')
- compile project(':jme3-niftygui')
- compile project(':jme3-plugins')
- compile project(':jme3-terrain')
- compile project(':jme3-testdata')
-}
+apply plugin: 'com.android.application'
android {
- compileSdkVersion 10
- buildToolsVersion "22.0.1"
+ compileSdkVersion 23
+ buildToolsVersion "23.0.3"
lintOptions {
// Fix nifty gui referencing "java.awt" package.
disable 'InvalidPackage'
+ abortOnError false
}
defaultConfig {
- applicationId "com.jme3.android"
- minSdkVersion 10 // Android 2.3 GINGERBREAD
+ applicationId "org.jmonkeyengine.jme3androidexamples"
+ minSdkVersion 11 // Android 2.3 GINGERBREAD
targetSdkVersion 22 // Android 5.1 LOLLIPOP
versionCode 1
versionName "1.0" // TODO: from settings.gradle
@@ -31,10 +21,63 @@ android {
buildTypes {
release {
minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
- debug {
- applicationIdSuffix ".debug"
- debuggable true
+ }
+
+// sourceSets {
+// main.java.srcDirs += ['../jme3-examples/src/main/java' exclude 'TestChooser.java']
+// }
+ sourceSets {
+ main {
+ java {
+ srcDir 'src/main/java'
+// srcDir '../jme3-examples/src/main/java'
+// exclude '**/TestChooser.java'
+// exclude '**/awt/**'
+ }
}
}
-}
\ No newline at end of file
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support:appcompat-v7:23.3.0'
+
+ compile project(':jme3-core')
+ compile project(':jme3-android')
+ compile project(':jme3-android-native')
+ compile project(':jme3-effects')
+ compile project(':jme3-bullet')
+ compile project(':jme3-bullet-native-android')
+ compile project(':jme3-networking')
+ compile project(':jme3-niftygui')
+ compile project(':jme3-plugins')
+ compile project(':jme3-terrain')
+ compile project(':jme3-testdata')
+// compile project(':jme3-examples')
+}
+
+//task copyTestClasses(type: Copy) {
+// def sourceDir = file("../jme-examples/src/main/java")
+// def outputDir = file("src/main/java")
+//
+// from sourceDir
+// into outputDir
+//}
+//
+//task copyTestResources(type: Copy) {
+// def sourceDir = file("../jme-examples/src/main/resources")
+// def outputDir = file("src/main/resources")
+//
+// from sourceDir
+// into outputDir
+//}
+//
+//// copy test classes and resources from jme3-examples module
+//assembleDebug.dependsOn {
+// copyTestClasses
+// copyTestResources
+//}
+
diff --git a/jme3-android-examples/proguard-rules.pro b/jme3-android-examples/proguard-rules.pro
new file mode 100644
index 000000000..6c8c8be35
--- /dev/null
+++ b/jme3-android-examples/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\potterec\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/jme3-android-examples/src/androidTest/java/org/jmonkeyengine/jme3androidexamples/ApplicationTest.java b/jme3-android-examples/src/androidTest/java/org/jmonkeyengine/jme3androidexamples/ApplicationTest.java
new file mode 100644
index 000000000..dff82ddb8
--- /dev/null
+++ b/jme3-android-examples/src/androidTest/java/org/jmonkeyengine/jme3androidexamples/ApplicationTest.java
@@ -0,0 +1,13 @@
+package org.jmonkeyengine.jme3androidexamples;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/jme3-android-examples/src/main/AndroidManifest.xml b/jme3-android-examples/src/main/AndroidManifest.xml
index ee80b6b28..dcc883ef1 100644
--- a/jme3-android-examples/src/main/AndroidManifest.xml
+++ b/jme3-android-examples/src/main/AndroidManifest.xml
@@ -1,20 +1,49 @@
+
+ package="org.jmonkeyengine.jme3androidexamples">
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/jme3-android-examples/src/main/java/jme3test/android/TestChooserAndroid.java b/jme3-android-examples/src/main/java/jme3test/android/TestChooserAndroid.java
deleted file mode 100644
index e704bc85a..000000000
--- a/jme3-android-examples/src/main/java/jme3test/android/TestChooserAndroid.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package jme3test.android;
-
-import android.content.pm.ActivityInfo;
-import android.app.*;
-import android.os.Bundle;
-
-public class TestChooserAndroid extends Activity {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- }
-}
\ No newline at end of file
diff --git a/jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/CustomArrayAdapter.java b/jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/CustomArrayAdapter.java
new file mode 100644
index 000000000..4d3808796
--- /dev/null
+++ b/jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/CustomArrayAdapter.java
@@ -0,0 +1,165 @@
+package org.jmonkeyengine.jme3androidexamples;
+
+import android.content.Context;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.Filter;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CustomArrayAdapter extends ArrayAdapter {
+ private static final String TAG = "CustomArrayAdapter";
+
+ /* List of items */
+ private List entries;
+ private Context activity;
+
+ /* Position of selected answer */
+ private int selectedPosition = -1;
+ /* Background Color of selected item */
+ private int selectedBackgroundColor = 0xffff00;
+ /* Background Color of non selected item */
+ private int nonselectedBackgroundColor = 0x000000;
+ /* Background Drawable Resource ID of selected item */
+ private int selectedBackgroundResource = 0;
+ /* Background Drawable Resource ID of non selected items */
+ private int nonselectedBackgroundResource = 0;
+
+ /* Variables to support list filtering */
+ private ArrayList filteredEntries;
+ private Filter filter;
+
+ public CustomArrayAdapter(Context context, int textViewResourceId, List objects) {
+ super(context, textViewResourceId, objects);
+ activity = context;
+ entries = new ArrayList(objects);
+ filteredEntries = new ArrayList(objects);
+ filter = new ClassNameFilter();
+ }
+
+ /** Setter for selected item position */
+ public void setSelectedPosition(int selectedPosition) {
+ this.selectedPosition = selectedPosition;
+ Log.i(TAG, "Setting position to: " + this.selectedPosition);
+ }
+
+ /** Setter for selected item background color */
+ public void setSelectedBackgroundColor(int selectedBackgroundColor) {
+ this.selectedBackgroundColor = selectedBackgroundColor;
+ }
+
+ /** Setter for non selected background color */
+ public void setNonSelectedBackgroundColor(int nonselectedBackgroundColor) {
+ this.nonselectedBackgroundColor = nonselectedBackgroundColor;
+ }
+
+ /** Setter for selected item background resource id*/
+ public void setSelectedBackgroundResource(int selectedBackgroundResource) {
+ this.selectedBackgroundResource = selectedBackgroundResource;
+ }
+
+ /** Setter for non selected background resource id*/
+ public void setNonSelectedBackgroundResource(int nonselectedBackgroundResource) {
+ this.nonselectedBackgroundResource = nonselectedBackgroundResource;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ Log.i(TAG, "getView for position: " + position + " with selectedItem: " + selectedPosition);
+
+ View v = convertView;
+ ViewHolder holder;
+ if (v == null) {
+ LayoutInflater vi =
+ (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ v = vi.inflate(R.layout.test_chooser_row, null);
+ holder = new ViewHolder();
+ holder.textView = (TextView) v.findViewById(R.id.txtClassName);
+ holder.layoutRow = (LinearLayout) v.findViewById(R.id.layoutTestChooserRow);
+ v.setTag(holder);
+ } else {
+ holder=(ViewHolder)v.getTag();
+ }
+
+ final String itemText = filteredEntries.get(position);
+ if (itemText != null) {
+ holder.textView.setText(itemText);
+ if (position == selectedPosition) {
+ Log.i(TAG, "setting Background Color to: " + selectedBackgroundColor);
+// holder.textView.setBackgroundColor(selectedBackgroundColor);
+// holder.textView.setBackgroundResource(selectedBackgroundResource);
+ holder.layoutRow.setBackgroundResource(selectedBackgroundResource);
+ } else {
+ Log.i(TAG, "setting Background Color to: " + nonselectedBackgroundColor);
+// holder.textView.setBackgroundColor(nonselectedBackgroundColor);
+// holder.textView.setBackgroundResource(nonselectedBackgroundResource);
+ holder.layoutRow.setBackgroundResource(nonselectedBackgroundResource);
+ }
+ }
+ return v;
+
+ }
+
+ @Override
+ public Filter getFilter(){
+ if(filter == null){
+ filter = new ClassNameFilter();
+ }
+ return filter;
+ }
+
+ public static class ViewHolder{
+ public TextView textView;
+ public LinearLayout layoutRow;
+ }
+
+ private class ClassNameFilter extends Filter{
+ @Override
+ protected FilterResults performFiltering(CharSequence constraint){
+ FilterResults results = new FilterResults();
+ String prefix = constraint.toString().toLowerCase();
+ Log.i(TAG, "performFiltering: entries size: " + entries.size());
+ if (prefix == null || prefix.length() == 0){
+ ArrayList list = new ArrayList(entries);
+ results.values = list;
+ results.count = list.size();
+ Log.i(TAG, "clearing filter with size: " + list.size());
+ }else{
+ final ArrayList list = new ArrayList(entries);
+ final ArrayList nlist = new ArrayList();
+ int count = list.size();
+
+ for (int i = 0; i)results.values;
+ notifyDataSetChanged();
+ clear();
+ int count = filteredEntries.size();
+ for(int i = 0; i classNames = new ArrayList();
+ private List exclusions = new ArrayList();
+ private String rootPackage;
+
+ /* ListView that displays the test application class names. */
+ private ListView listClasses;
+
+ /* ArrayAdapter connects the spinner widget to array-based data. */
+ private CustomArrayAdapter arrayAdapter;
+
+ /* Buttons to start application or stop the activity. */
+ private Button btnOK;
+ private Button btnCancel;
+
+ /* Filter Edit Box */
+ EditText editFilterText;
+
+ /* Custom settings for the test app */
+ private boolean enableMouseEvents = true;
+ private boolean enableJoystickEvents = false;
+ private boolean enableKeyEvents = true;
+
+
+ /**
+ * Called when the activity is first created.
+ */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ if (savedInstanceState != null) {
+ Log.i(TAG, "Restoring selections in onCreate: "
+ + "position: " + savedInstanceState.getInt(SELECTED_LIST_POSITION, 0)
+ + "class: " + savedInstanceState.getString(SELECTED_APP_CLASS)
+ );
+ currentPosition = savedInstanceState.getInt(SELECTED_LIST_POSITION, 0);
+ currentSelection = savedInstanceState.getString(SELECTED_APP_CLASS);
+ enableMouseEvents = savedInstanceState.getBoolean(ENABLE_MOUSE_EVENTS, true);
+ enableJoystickEvents = savedInstanceState.getBoolean(ENABLE_JOYSTICK_EVENTS, false);
+ enableKeyEvents = savedInstanceState.getBoolean(ENABLE_KEY_EVENTS, true);
+ }
+
+
+ /* Set content view and register views */
+ setContentView(R.layout.test_chooser_layout);
+ btnOK = (Button) findViewById(R.id.btnOK);
+ btnCancel = (Button) findViewById(R.id.btnCancel);
+ listClasses = (ListView) findViewById(R.id.listClasses);
+ editFilterText = (EditText) findViewById(R.id.txtFilter);
+
+
+ /* Define the root package to start with */
+ rootPackage = "jme3test";
+
+ /* Create an array of Strings to define which classes to exclude */
+ exclusions.add("$"); // inner classes
+ exclusions.add("TestChooser"); // Desktop test chooser class
+ exclusions.add("awt"); // Desktop test chooser class
+
+// mExclusions.add("");
+
+ /*
+ * Read the class names from the dex file and filter based on
+ * name and super class.
+ */
+
+ Log.i(TAG, "Composing Test list...");
+
+ ApplicationInfo ai = this.getApplicationInfo();
+ String classPath = ai.sourceDir;
+ DexFile dex = null;
+ Enumeration apkClassNames = null;
+ try {
+ dex = new DexFile(classPath);
+ apkClassNames = dex.entries();
+ while (apkClassNames.hasMoreElements()) {
+ String className = apkClassNames.nextElement();
+ if (checkClassName(className) && checkClassType(className)) {
+ classNames.add(className);
+ }
+// classNames.add(className);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ dex.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /*
+ * Create a backing Adapter for the List View from a list of the
+ * classes. The list is defined by array of class names.
+ */
+ arrayAdapter = new CustomArrayAdapter(
+ this,
+ R.layout.test_chooser_row, // text view to display selection
+ classNames // array of strings to display
+ );
+
+ /* Set the resource id for selected and non selected backgrounds */
+ Log.i(TAG, "Setting Adapter Background Resource IDs");
+ arrayAdapter.setSelectedBackgroundResource(R.drawable.selected);
+ arrayAdapter.setNonSelectedBackgroundResource(R.drawable.nonselected);
+
+ /* Attach the Adapter to the spinner */
+ Log.i(TAG, "Setting ListView Adapter");
+ listClasses.setAdapter(arrayAdapter);
+
+ /* Set initial selection for the list */
+ setSelection(currentPosition);
+
+ /* Set Click and Text Changed listeners */
+ listClasses.setOnItemClickListener(this);
+ btnOK.setOnClickListener(this);
+ btnCancel.setOnClickListener(this);
+ editFilterText.addTextChangedListener(this);
+
+ }
+
+ /**
+ * User selected an application. Sets the current selection and redraws
+ * the list view to highlight the selected item.
+ * @param parent AdapterView tied to the list
+ * @param view The ListView
+ * @param position Selection position in the list of class names
+ * @param id
+ */
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ setSelection(position);
+ }
+
+ /**
+ * User clicked a view on the screen. Check for the OK and Cancel buttons
+ * and either start the applicaiton or exit.
+ * @param view
+ */
+ public void onClick(View view) {
+ if (view.equals(btnOK)) {
+ /* Get selected class, pack it in the intent and start the test app */
+ Log.i(TAG, "User selected OK for class: " + currentSelection);
+ Intent intent = new Intent(this, TestActivity.class);
+ intent.putExtra(SELECTED_APP_CLASS, currentSelection);
+ intent.putExtra(ENABLE_MOUSE_EVENTS, enableMouseEvents);
+ intent.putExtra(ENABLE_JOYSTICK_EVENTS, enableJoystickEvents);
+ startActivity(intent);
+ } else if (view.equals(btnCancel)) {
+ /* Exit */
+ Log.i(TAG, "User selected Cancel");
+ finish();
+ }
+ }
+
+ /**
+ * Check class name to see if the class is in the root package and if it
+ * contains any of the exclusion strings
+ * @param className Class name to check
+ * @return true if the check passes, false otherwise
+ */
+ private boolean checkClassName(String className) {
+ boolean include = true;
+ /* check to see if the class in inside the rootPackage package */
+ if (className.startsWith(rootPackage)) {
+ /* check to see if the class contains any of the exlusion strings */
+ for (int i = 0; i < exclusions.size(); i++) {
+ if (className.contains(exclusions.get(i))) {
+ Log.i(TAG, "Skipping Class " + className + ". Includes exclusion string: " + exclusions.get(i) + ".");
+ include = false;
+ break;
+ }
+ }
+ } else {
+ include = false;
+ Log.i(TAG, "Skipping Class " + className + ". Not in the root package: " + rootPackage + ".");
+ }
+ return include;
+ }
+
+ /**
+ * Check to see if the class extends Application or SimpleApplication
+ * @param className Class name to check
+ * @return true if the check passes, false otherwise
+ */
+ private boolean checkClassType(String className) {
+ boolean include = true;
+ try {
+ Class> clazz = (Class>)Class.forName(className);
+ if (Application.class.isAssignableFrom(clazz)) {
+ Log.i(TAG, "Class " + className + " is a jME Application");
+ } else {
+ include = false;
+ Log.i(TAG, "Skipping Class " + className + ". Not a jME Application");
+ }
+
+ } catch (ClassNotFoundException cnfe) {
+ include = false;
+ Log.i(TAG, "Skipping Class " + className + ". Class not found.");
+ }
+ return include;
+ }
+
+ private void setSelection(int position) {
+ if (position == -1) {
+ arrayAdapter.setSelectedPosition(-1);
+ currentPosition = -1;
+ currentSelection = "";
+ btnOK.setEnabled(false);
+ listClasses.invalidateViews();
+ } else {
+ arrayAdapter.setSelectedPosition(position);
+ currentPosition = position;
+ currentSelection = arrayAdapter.getItem(position);
+ btnOK.setEnabled(true);
+ listClasses.invalidateViews();
+ }
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle savedInstanceState) {
+ super.onSaveInstanceState(savedInstanceState);
+ Log.i(TAG, "Saving selections in onSaveInstanceState: "
+ + "position: " + currentPosition + ", "
+ + "class: " + currentSelection + ", "
+ + "mouseEvents: " + enableMouseEvents + ", "
+ + "joystickEvents: " + enableJoystickEvents + ", "
+ );
+ // Save current selections to the savedInstanceState.
+ // This bundle will be passed to onCreate if the process is
+ // killed and restarted.
+ savedInstanceState.putString(SELECTED_APP_CLASS, currentSelection);
+ savedInstanceState.putInt(SELECTED_LIST_POSITION, currentPosition);
+ savedInstanceState.putBoolean(ENABLE_MOUSE_EVENTS, enableMouseEvents);
+ savedInstanceState.putBoolean(ENABLE_JOYSTICK_EVENTS, enableJoystickEvents);
+ }
+
+ @Override
+ public void onRestoreInstanceState(Bundle savedInstanceState) {
+ super.onRestoreInstanceState(savedInstanceState);
+// Log.i(TAG, "Restoring selections in onRestoreInstanceState: "
+// + "position: " + savedInstanceState.getInt(SELECTED_LIST_POSITION, 0)
+// + "class: " + savedInstanceState.getString(SELECTED_APP_CLASS)
+// );
+// //Restore selections from the savedInstanceState.
+// // This bundle has also been passed to onCreate.
+// currentPosition = savedInstanceState.getInt(SELECTED_LIST_POSITION, 0);
+// currentSelection = savedInstanceState.getString(SELECTED_APP_CLASS);
+ }
+
+ public void beforeTextChanged(CharSequence cs, int i, int i1, int i2) {
+ }
+
+ public void onTextChanged(CharSequence cs, int startPos, int beforePos, int count) {
+ Log.i(TAG, "onTextChanged with cs: " + cs + ", startPos: " + startPos + ", beforePos: " + beforePos + ", count: " + count);
+ arrayAdapter.getFilter().filter(cs.toString());
+ setSelection(-1);
+ }
+
+ public void afterTextChanged(Editable edtbl) {
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ editFilterText.removeTextChangedListener(this);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.menu_items, menu);
+
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu (Menu menu) {
+ MenuItem item;
+
+ item = menu.findItem(R.id.optionMouseEvents);
+ if (item != null) {
+ Log.i(TAG, "Found EnableMouseEvents menu item");
+ if (enableMouseEvents) {
+ item.setTitle(R.string.strOptionDisableMouseEventsTitle);
+ } else {
+ item.setTitle(R.string.strOptionEnableMouseEventsTitle);
+ }
+ }
+
+ item = menu.findItem(R.id.optionJoystickEvents);
+ if (item != null) {
+ Log.i(TAG, "Found EnableJoystickEvents menu item");
+ if (enableJoystickEvents) {
+ item.setTitle(R.string.strOptionDisableJoystickEventsTitle);
+ } else {
+ item.setTitle(R.string.strOptionEnableJoystickEventsTitle);
+ }
+ }
+
+ item = menu.findItem(R.id.optionKeyEvents);
+ if (item != null) {
+ Log.i(TAG, "Found EnableKeyEvents menu item");
+ if (enableKeyEvents) {
+ item.setTitle(R.string.strOptionDisableKeyEventsTitle);
+ } else {
+ item.setTitle(R.string.strOptionEnableKeyEventsTitle);
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.optionMouseEvents:
+ enableMouseEvents = !enableMouseEvents;
+ Log.i(TAG, "enableMouseEvents set to: " + enableMouseEvents);
+ break;
+ case R.id.optionJoystickEvents:
+ enableJoystickEvents = !enableJoystickEvents;
+ Log.i(TAG, "enableJoystickEvents set to: " + enableJoystickEvents);
+ break;
+ case R.id.optionKeyEvents:
+ enableKeyEvents = !enableKeyEvents;
+ Log.i(TAG, "enableKeyEvents set to: " + enableKeyEvents);
+ break;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+
+ return true;
+
+ }
+
+}
\ No newline at end of file
diff --git a/jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/TestActivity.java b/jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/TestActivity.java
new file mode 100644
index 000000000..e983ef6af
--- /dev/null
+++ b/jme3-android-examples/src/main/java/org/jmonkeyengine/jme3androidexamples/TestActivity.java
@@ -0,0 +1,49 @@
+package org.jmonkeyengine.jme3androidexamples;
+
+import android.app.FragmentTransaction;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.util.Log;
+
+public class TestActivity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_test);
+
+ JmeFragment fragment = new JmeFragment();
+ // Supply index input as an argument.
+ Bundle args = new Bundle();
+
+ String appClass = savedInstanceState.getString(MainActivity.SELECTED_APP_CLASS);
+ args.putString(MainActivity.SELECTED_APP_CLASS, appClass);
+ Log.d(TestActivity.class.getSimpleName(), "AppClass="+appClass);
+
+ boolean mouseEnabled = savedInstanceState.getBoolean(MainActivity.ENABLE_MOUSE_EVENTS, true);
+ args.putBoolean(MainActivity.ENABLE_MOUSE_EVENTS, mouseEnabled);
+ Log.d(TestActivity.class.getSimpleName(), "MouseEnabled="+mouseEnabled);
+
+ boolean joystickEnabled = savedInstanceState.getBoolean(MainActivity.ENABLE_JOYSTICK_EVENTS, true);
+ args.putBoolean(MainActivity.ENABLE_JOYSTICK_EVENTS, joystickEnabled);
+ Log.d(TestActivity.class.getSimpleName(), "JoystickEnabled="+joystickEnabled);
+
+ boolean keyEnabled = savedInstanceState.getBoolean(MainActivity.ENABLE_KEY_EVENTS, true);
+ args.putBoolean(MainActivity.ENABLE_KEY_EVENTS, keyEnabled);
+ Log.d(TestActivity.class.getSimpleName(), "KeyEnabled="+keyEnabled);
+
+ fragment.setArguments(args);
+
+
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+
+ // Replace whatever is in the fragment_container view with this fragment,
+ // and add the transaction to the back stack so the user can navigate back
+ transaction.replace(R.id.jMEFragment, fragment);
+ transaction.addToBackStack(null);
+
+ // Commit the transaction
+ transaction.commit();
+
+ }
+}
diff --git a/jme3-android-examples/src/main/res/drawable/monkey256.png b/jme3-android-examples/src/main/res/drawable/monkey256.png
new file mode 100644
index 000000000..aa43ad6cf
Binary files /dev/null and b/jme3-android-examples/src/main/res/drawable/monkey256.png differ
diff --git a/jme3-android-examples/src/main/res/drawable/monkey256_9.9.png b/jme3-android-examples/src/main/res/drawable/monkey256_9.9.png
new file mode 100644
index 000000000..4c90f34a1
Binary files /dev/null and b/jme3-android-examples/src/main/res/drawable/monkey256_9.9.png differ
diff --git a/jme3-android-examples/src/main/res/drawable/monkey512.png b/jme3-android-examples/src/main/res/drawable/monkey512.png
new file mode 100644
index 000000000..c31857454
Binary files /dev/null and b/jme3-android-examples/src/main/res/drawable/monkey512.png differ
diff --git a/jme3-android-examples/src/main/res/drawable/monkey512_9.9.png b/jme3-android-examples/src/main/res/drawable/monkey512_9.9.png
new file mode 100644
index 000000000..39d45a961
Binary files /dev/null and b/jme3-android-examples/src/main/res/drawable/monkey512_9.9.png differ
diff --git a/jme3-android-examples/src/main/res/drawable/nonselected.png b/jme3-android-examples/src/main/res/drawable/nonselected.png
new file mode 100644
index 000000000..45cafef25
Binary files /dev/null and b/jme3-android-examples/src/main/res/drawable/nonselected.png differ
diff --git a/jme3-android-examples/src/main/res/drawable/selected.png b/jme3-android-examples/src/main/res/drawable/selected.png
new file mode 100644
index 000000000..ba92fce41
Binary files /dev/null and b/jme3-android-examples/src/main/res/drawable/selected.png differ
diff --git a/jme3-android-examples/src/main/res/layout/activity_test.xml b/jme3-android-examples/src/main/res/layout/activity_test.xml
new file mode 100644
index 000000000..3c81d0458
--- /dev/null
+++ b/jme3-android-examples/src/main/res/layout/activity_test.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
diff --git a/jme3-android-examples/src/main/res/layout/test_chooser_layout.xml b/jme3-android-examples/src/main/res/layout/test_chooser_layout.xml
new file mode 100644
index 000000000..dc46248e6
--- /dev/null
+++ b/jme3-android-examples/src/main/res/layout/test_chooser_layout.xml
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jme3-android-examples/src/main/res/layout/test_chooser_row.xml b/jme3-android-examples/src/main/res/layout/test_chooser_row.xml
new file mode 100644
index 000000000..b0c7bb586
--- /dev/null
+++ b/jme3-android-examples/src/main/res/layout/test_chooser_row.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jme3-android-examples/src/main/res/menu/menu_items.xml b/jme3-android-examples/src/main/res/menu/menu_items.xml
new file mode 100644
index 000000000..4eee2b3e1
--- /dev/null
+++ b/jme3-android-examples/src/main/res/menu/menu_items.xml
@@ -0,0 +1,29 @@
+
diff --git a/jme3-android-examples/src/main/res/mipmap-hdpi/smartmonkey.png b/jme3-android-examples/src/main/res/mipmap-hdpi/smartmonkey.png
new file mode 100644
index 000000000..ee5e2093c
Binary files /dev/null and b/jme3-android-examples/src/main/res/mipmap-hdpi/smartmonkey.png differ
diff --git a/jme3-android-examples/src/main/res/mipmap-mdpi/smartmonkey.png b/jme3-android-examples/src/main/res/mipmap-mdpi/smartmonkey.png
new file mode 100644
index 000000000..34a91c428
Binary files /dev/null and b/jme3-android-examples/src/main/res/mipmap-mdpi/smartmonkey.png differ
diff --git a/jme3-android-examples/src/main/res/mipmap-xhdpi/smartmonkey.png b/jme3-android-examples/src/main/res/mipmap-xhdpi/smartmonkey.png
new file mode 100644
index 000000000..555c72276
Binary files /dev/null and b/jme3-android-examples/src/main/res/mipmap-xhdpi/smartmonkey.png differ
diff --git a/jme3-android-examples/src/main/res/mipmap-xxhdpi/smartmonkey.png b/jme3-android-examples/src/main/res/mipmap-xxhdpi/smartmonkey.png
new file mode 100644
index 000000000..02417f986
Binary files /dev/null and b/jme3-android-examples/src/main/res/mipmap-xxhdpi/smartmonkey.png differ
diff --git a/jme3-android-examples/src/main/res/mipmap-xxxhdpi/smartmonkey.png b/jme3-android-examples/src/main/res/mipmap-xxxhdpi/smartmonkey.png
new file mode 100644
index 000000000..02417f986
Binary files /dev/null and b/jme3-android-examples/src/main/res/mipmap-xxxhdpi/smartmonkey.png differ
diff --git a/jme3-android-examples/src/main/res/values-w820dp/dimens.xml b/jme3-android-examples/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 000000000..63fc81644
--- /dev/null
+++ b/jme3-android-examples/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/jme3-android-examples/src/main/res/values/colors.xml b/jme3-android-examples/src/main/res/values/colors.xml
new file mode 100644
index 000000000..3ab3e9cbc
--- /dev/null
+++ b/jme3-android-examples/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/jme3-android-examples/src/main/res/values/dimens.xml b/jme3-android-examples/src/main/res/values/dimens.xml
new file mode 100644
index 000000000..47c822467
--- /dev/null
+++ b/jme3-android-examples/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/jme3-android-examples/src/main/res/values/strings.xml b/jme3-android-examples/src/main/res/values/strings.xml
index b184fa936..2df08ee36 100644
--- a/jme3-android-examples/src/main/res/values/strings.xml
+++ b/jme3-android-examples/src/main/res/values/strings.xml
@@ -1,6 +1,19 @@
-
- JMEAndroidTest
- About
- Quit
-
\ No newline at end of file
+
+ jME3 Tests Android
+
+
+ Choose a demo to start:
+ Find:
+ Enter a Filter
+ OK
+ Cancel
+
+
+ Enable Mouse Events
+ Disable Mouse Events
+ Enable Joystick Events
+ Disable Joystick Events
+ Enable Key Events
+ Disable Key Events
+
diff --git a/jme3-android-examples/src/main/res/values/styles.xml b/jme3-android-examples/src/main/res/values/styles.xml
new file mode 100644
index 000000000..5885930df
--- /dev/null
+++ b/jme3-android-examples/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/jme3-android-examples/src/test/java/org/jmonkeyengine/jme3androidexamples/ExampleUnitTest.java b/jme3-android-examples/src/test/java/org/jmonkeyengine/jme3androidexamples/ExampleUnitTest.java
new file mode 100644
index 000000000..3c2dcb42b
--- /dev/null
+++ b/jme3-android-examples/src/test/java/org/jmonkeyengine/jme3androidexamples/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package org.jmonkeyengine.jme3androidexamples;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file