From 3973f4f9520b0c1d44a02098e2fa520771f04143 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Tue, 4 Dec 2012 12:06:05 -0800 Subject: [PATCH] More back button woes! The Fix for CB-1960 did weird things on both my end and Simon's end, sadly they're both different things. This should simply the code and resolve it. Sadly, all the unit tests pass as usual. --- framework/src/org/apache/cordova/DroidGap.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java index 11c3a5f4..ecff67ac 100755 --- a/framework/src/org/apache/cordova/DroidGap.java +++ b/framework/src/org/apache/cordova/DroidGap.java @@ -1010,12 +1010,7 @@ public class DroidGap extends Activity implements CordovaInterface { { //Get whatever has focus! View childView = appView.getFocusedChild(); - //Determine if the focus is on the current view or not - if (appView.getHitTestResult() != null && childView == null && - appView.getHitTestResult().getType() == WebView.HitTestResult.EDIT_TEXT_TYPE && - (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU)) { - return appView.onKeyUp(keyCode, event); - } else if (appView.isCustomViewShowing() && keyCode == KeyEvent.KEYCODE_BACK) { + if ((appView.isCustomViewShowing() || childView != null ) && keyCode == KeyEvent.KEYCODE_BACK) { return appView.onKeyUp(keyCode, event); } else { return super.onKeyUp(keyCode, event); @@ -1032,10 +1027,10 @@ public class DroidGap extends Activity implements CordovaInterface { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { + //Get whatever has focus! + View childView = appView.getFocusedChild(); //Determine if the focus is on the current view or not - if (appView.getHitTestResult() != null && - appView.getHitTestResult().getType() == WebView.HitTestResult.EDIT_TEXT_TYPE && - keyCode == KeyEvent.KEYCODE_BACK) { + if (childView != null && keyCode == KeyEvent.KEYCODE_BACK) { return appView.onKeyDown(keyCode, event); } else