diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index 234ff65c..30b65b37 100755 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -81,6 +81,8 @@ public class CordovaWebView extends WebView { private boolean volumeupBound; + private boolean handleButton = false; + /** * Constructor. * @@ -749,7 +751,6 @@ public class CordovaWebView extends WebView { return super.onKeyUp(keyCode, event); } - Log.d(TAG, "KeyUp has been triggered on the view"); return false; } @@ -788,6 +789,7 @@ public class CordovaWebView extends WebView { public void handlePause(boolean keepRunning) { + LOG.d(TAG, "Handle the pause"); // Send pause event to JavaScript this.loadUrl("javascript:try{cordova.fireDocumentEvent('pause');}catch(e){console.log('exception firing pause event from native');};"); @@ -843,4 +845,8 @@ public class CordovaWebView extends WebView { this.pluginManager.onNewIntent(intent); } } + + public boolean hadKeyEvent() { + return handleButton; + } } diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java index 4d6df528..a42f16cd 100755 --- a/framework/src/org/apache/cordova/DroidGap.java +++ b/framework/src/org/apache/cordova/DroidGap.java @@ -1032,5 +1032,20 @@ public class DroidGap extends Activity implements CordovaInterface { } return null; } + + /* + * (non-Javadoc) + * @see android.app.Activity#onKeyUp(int, android.view.KeyEvent) + */ + + @Override + public boolean onKeyUp(int keyCode, KeyEvent event) + { + if (appView.backHistory() || keyCode != KeyEvent.KEYCODE_BACK) + return appView.onKeyUp(keyCode, event); + else + return super.onKeyUp(keyCode, event); + } + }