incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject [6/13] android commit: Fixed back button behaviour. WIN
Date Thu, 19 Apr 2012 23:24:58 GMT
Fixed back button behaviour.  WIN


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/180696ba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/180696ba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/180696ba

Branch: refs/heads/CordovaWebView
Commit: 180696baec28d6e6b67e8bb23a5302f21bce6b79
Parents: 76820eb
Author: Joe Bowser <bowserj@apache.org>
Authored: Tue Apr 17 17:50:07 2012 -0700
Committer: Joe Bowser <bowserj@apache.org>
Committed: Tue Apr 17 17:50:07 2012 -0700

----------------------------------------------------------------------
 framework/src/org/apache/cordova/DroidGap.java |   33 ++++++++++--------
 1 files changed, 18 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/180696ba/framework/src/org/apache/cordova/DroidGap.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java
index c48bf50..decd10d 100755
--- a/framework/src/org/apache/cordova/DroidGap.java
+++ b/framework/src/org/apache/cordova/DroidGap.java
@@ -1071,8 +1071,25 @@ public class DroidGap extends Activity implements CordovaInterface
{
         this.finish();
     }
     
+    
+   /** 
+    * Called when the back key is pressed
+    * 
+    * (non-Javadoc)
+    * @see android.app.Activity#onBackPressed()
+    */
+   @Override
+   public void onBackPressed()
+   {
+     // If back key is bound, then send event to JavaScript
+     if (!(this.bound || this.backHistory())) {
+         this.activityState = ACTIVITY_EXITING;
+         super.onBackPressed();
+     }
+   }
+    
     /**
-     * Called when a key is pressed.
+     * Called when a key is de-pressed. (Key UP)
      * 
      * @param keyCode
      * @param event
@@ -1092,20 +1109,6 @@ public class DroidGap extends Activity implements CordovaInterface
{
                 return true;
             }
 
-            // If not bound
-            else {
-
-                // Go to previous page in webview if it is possible to go back
-                if (this.backHistory()) {
-                    return true;
-                }
-
-                // If not, then invoke behavior of super class
-                else {
-                    this.activityState = ACTIVITY_EXITING;
-                    return super.onKeyUp(keyCode, event);
-                }
-            }
         }
 
         // If menu key


Mime
View raw message