From 9e8abfb6ec90572dfcf466c44465b9eefaa0391c Mon Sep 17 00:00:00 2001 From: "iwg..ic" Date: Thu, 21 Nov 2013 18:20:38 +0000 Subject: [PATCH] Android: Remove Escape key mapping from InputManager (defined in SimpleApplication) when using Android platforms. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10898 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/android/com/jme3/app/AndroidHarness.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engine/src/android/com/jme3/app/AndroidHarness.java b/engine/src/android/com/jme3/app/AndroidHarness.java index 708602c76..0e108b3c2 100644 --- a/engine/src/android/com/jme3/app/AndroidHarness.java +++ b/engine/src/android/com/jme3/app/AndroidHarness.java @@ -530,6 +530,13 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt public void initialize() { app.initialize(); if (handleExitHook) { + // remove existing mapping from SimpleApplication that stops the app + // when the esc key is pressed (esc key = android back key) so that + // AndroidHarness can produce the exit app dialog box. + if (app.getInputManager().hasMapping(SimpleApplication.INPUT_MAPPING_EXIT)) { + app.getInputManager().deleteMapping(SimpleApplication.INPUT_MAPPING_EXIT); + } + app.getInputManager().addMapping(ESCAPE_EVENT, new TouchTrigger(TouchInput.KEYCODE_BACK)); app.getInputManager().addListener(this, new String[]{ESCAPE_EVENT}); }