summaryrefslogtreecommitdiffstats
path: root/platform/android/java/src/org/godotengine/godot/Godot.java
diff options
context:
space:
mode:
authorRamesh Ravone <ramesh.maran443@gmail.com>2017-10-15 10:35:13 +0530
committerRamesh Ravone <ramesh.maran443@gmail.com>2017-10-15 10:35:13 +0530
commit55784b0c384430e91a1c4601589c413c032cc0d5 (patch)
treeed95e6fbae1feab2acd3e49b0e5fc6fd3ae6536a /platform/android/java/src/org/godotengine/godot/Godot.java
parentba9486a4d30f1bef11ff3629af67a87c6264f569 (diff)
downloadredot-engine-55784b0c384430e91a1c4601589c413c032cc0d5.tar.gz
export onBackPress for Android Module
Diffstat (limited to 'platform/android/java/src/org/godotengine/godot/Godot.java')
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java
index 053dfa631a..59fefc498f 100644
--- a/platform/android/java/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/src/org/godotengine/godot/Godot.java
@@ -191,6 +191,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
protected void onMainPause() {}
protected void onMainResume() {}
protected void onMainDestroy() {}
+ protected boolean onMainBackPressed() { return false; }
protected void onGLDrawFrame(GL10 gl) {}
protected void onGLSurfaceChanged(GL10 gl, int width, int height) {} // singletons will always miss first onGLSurfaceChanged call
@@ -767,9 +768,16 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
*/
@Override public void onBackPressed() {
+ boolean shouldQuit = true;
+
+ for(int i=0;i<singleton_count;i++) {
+ if (singletons[i].onMainBackPressed()) {
+ shouldQuit = false;
+ }
+ }
System.out.printf("** BACK REQUEST!\n");
- if (mView != null) {
+ if (shouldQuit && mView != null) {
mView.queueEvent(new Runnable() {
@Override
public void run() {