incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject android commit: Reverting the back button change that I made, for some reason certain methods aren't inherited when you extend DroidGap
Date Thu, 19 Apr 2012 19:22:56 GMT
Updated Branches:
  refs/heads/master 7b75e2f1b -> 1e5457a47


Reverting the back button change that I made, for some reason certain methods aren't inherited
when you extend DroidGap


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/1e5457a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/1e5457a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/1e5457a4

Branch: refs/heads/master
Commit: 1e5457a47d338a49abda674af5480f2cf4416c1b
Parents: 7b75e2f
Author: Joe Bowser <bowserj@apache.org>
Authored: Thu Apr 19 12:22:33 2012 -0700
Committer: Joe Bowser <bowserj@apache.org>
Committed: Thu Apr 19 12:22:33 2012 -0700

----------------------------------------------------------------------
 framework/src/org/apache/cordova/DroidGap.java |   26 +++++++++++++++++-
 1 files changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/1e5457a4/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 decd10d..031bb45 100755
--- a/framework/src/org/apache/cordova/DroidGap.java
+++ b/framework/src/org/apache/cordova/DroidGap.java
@@ -48,6 +48,7 @@ import android.graphics.Color;
 import android.media.AudioManager;
 import android.net.Uri;
 import android.os.Bundle;
+import android.util.Log;
 import android.view.Display;
 import android.view.KeyEvent;
 import android.view.Menu;
@@ -1078,15 +1079,23 @@ public class DroidGap extends Activity implements CordovaInterface
{
     * (non-Javadoc)
     * @see android.app.Activity#onBackPressed()
     */
+   /*
    @Override
    public void onBackPressed()
    {
-     // If back key is bound, then send event to JavaScript
+       Log.d("BackPressed", "in onBackPressed"); 
+       Log.d("BackPressed", "bound = " + this.bound);
+       //Log.d("BackPressed", "backHistory = " + this.backHistory());
+       // If back key is bound, then send event to JavaScript
+
      if (!(this.bound || this.backHistory())) {
+         Log.d("BackPressed", "exiting");
          this.activityState = ACTIVITY_EXITING;
          super.onBackPressed();
      }
    }
+  */
+
     
     /**
      * Called when a key is de-pressed. (Key UP)
@@ -1102,13 +1111,25 @@ public class DroidGap extends Activity implements CordovaInterface
{
 
         // If back key
         if (keyCode == KeyEvent.KEYCODE_BACK) {
+            Log.d("BackButton", "I got an up from KEYCODE_BACK");
 
             // If back key is bound, then send event to JavaScript
             if (this.bound) {
+                Log.d("BackButton", "bound is true firing an event to JS");
                 this.appView.loadUrl("javascript:cordova.fireDocumentEvent('backbutton');");
                 return true;
+            } else {
+                // If not bound
+                // 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
@@ -1123,6 +1144,7 @@ public class DroidGap extends Activity implements CordovaInterface {
             return true;
         }
 
+        Log.d("BackPressed", "returning false");
         return false;
     }
 


Mime
View raw message