Android : OGLESContext can now finish the activity when being destroyed, this way calling app.stop() from jME finished the associated activity.

This feature can be disabled by setting a flag in the MainActivity.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9234 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent 2bde71b08a
commit d2b727cfd8
  1. 10
      engine/src/android/com/jme3/app/AndroidHarness.java
  2. 7
      engine/src/android/com/jme3/system/android/OGLESContext.java

@ -69,6 +69,10 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt
* Flip Y axis
*/
protected boolean mouseEventsInvertY = true;
/**
* if true finish this activity when the jme app is stopped
*/
protected boolean finishOnAppStop = true;
/**
* Title of the exit dialog, default is "Do you want to exit?"
*/
@ -395,4 +399,10 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt
}
}
}
public boolean isFinishOnAppStop() {
return finishOnAppStop;
}
}

@ -282,6 +282,13 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex
logger.info("Display destroyed.");
renderable.set(false);
final Context ctx = this.view.getContext();
if (ctx instanceof AndroidHarness) {
AndroidHarness harness = (AndroidHarness) ctx;
if (harness.isFinishOnAppStop()) {
harness.finish();
}
}
}
}

Loading…
Cancel
Save