incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject [3/5] android commit: Working on CB-585
Date Fri, 04 May 2012 18:50:09 GMT
Working on CB-585


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

Branch: refs/heads/CordovaWebView
Commit: 480e5ca4d1faf7c0c434f8031f77f9ef98197f05
Parents: f4cf2ce
Author: Joe Bowser <bowserj@apache.org>
Authored: Fri May 4 11:18:19 2012 -0700
Committer: Joe Bowser <bowserj@apache.org>
Committed: Fri May 4 11:18:19 2012 -0700

----------------------------------------------------------------------
 framework/res/xml/cordova.xml                      |    2 +-
 .../src/org/apache/cordova/CordovaWebView.java     |    8 ++++++--
 .../org/apache/cordova/CordovaWebViewClient.java   |    6 +++++-
 framework/src/org/apache/cordova/DroidGap.java     |    8 +++++++-
 4 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/480e5ca4/framework/res/xml/cordova.xml
----------------------------------------------------------------------
diff --git a/framework/res/xml/cordova.xml b/framework/res/xml/cordova.xml
index ddf3029..0ad5e5f 100644
--- a/framework/res/xml/cordova.xml
+++ b/framework/res/xml/cordova.xml
@@ -30,7 +30,7 @@
 	<!-- <access origin=".*"/> Allow all domains, suggested development use only -->
 
     <log level="DEBUG"/>
-    <preference name="useWebkitHistory" value="false" />
+    <preference name="useBrowserHistory" value="false" />
 </cordova>
 
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/480e5ca4/framework/src/org/apache/cordova/CordovaWebView.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java
index 773f2b8..d3e9e12 100644
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -47,6 +47,8 @@ public class CordovaWebView extends WebView {
   String baseUrl;
   private Stack<String> urls = new Stack<String>();
 
+  boolean useBrowserHistory = false;
+  
   protected int loadUrlTimeout;
 
   protected long loadUrlTimeoutValue;
@@ -304,7 +306,8 @@ public class CordovaWebView extends WebView {
           }
           pluginManager.init();
           
-          this.urls.push(url);
+          if(!useBrowserHistory)
+            this.urls.push(url);
       }
     }
     
@@ -315,7 +318,8 @@ public class CordovaWebView extends WebView {
   public void loadUrl(final String url, final int time)
   {
     // If not first page of app, then load immediately
-    if (this.urls.size() > 0) {
+    // Add support for browser history if we use it.
+    if (this.urls.size() > 0 || this.canGoBack()) {
         this.loadUrl(url);
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/480e5ca4/framework/src/org/apache/cordova/CordovaWebViewClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebViewClient.java b/framework/src/org/apache/cordova/CordovaWebViewClient.java
index 7338ed2..e101c8b 100755
--- a/framework/src/org/apache/cordova/CordovaWebViewClient.java
+++ b/framework/src/org/apache/cordova/CordovaWebViewClient.java
@@ -152,7 +152,11 @@ public class CordovaWebViewClient extends WebViewClient {
             // If our app or file:, then load into a new Cordova webview container by starting
a new instance of our activity.
             // Our app continues to run.  When BACK is pressed, our app is redisplayed.
             if (url.startsWith("file://") || url.indexOf(appView.baseUrl) == 0 || appView.isUrlWhiteListed(url))
{
-                appView.loadUrl(url);
+                //This will fix iFrames
+                if(appView.useBrowserHistory)
+                  return false;
+                else
+                  appView.loadUrl(url);
             }
 
             // If not our application, let default viewer handle

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/480e5ca4/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 b084e5d..21e14aa 100755
--- a/framework/src/org/apache/cordova/DroidGap.java
+++ b/framework/src/org/apache/cordova/DroidGap.java
@@ -203,7 +203,10 @@ public class DroidGap extends Activity implements CordovaInterface {
     // If true, then the JavaScript and native code continue to run in the background
     // when another application (activity) is started.
     protected boolean keepRunning = true;
-
+    
+    // Store the useBrowserHistory preference until we actually need it.
+    private boolean useBrowserHistory = false;
+    
     // preferences read from cordova.xml
     protected PreferenceSet preferences;
     
@@ -225,6 +228,8 @@ public class DroidGap extends Activity implements CordovaInterface {
         if (preferences.prefMatches("fullscreen","true")) {
             getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                     WindowManager.LayoutParams.FLAG_FULLSCREEN);
+        } else if(preferences.prefMatches("useBrowserHistory", "true")) {
+          useBrowserHistory = true;
         } else {
             getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
                     WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
@@ -286,6 +291,7 @@ public class DroidGap extends Activity implements CordovaInterface {
 
         // Add web view but make it invisible while loading URL
         this.appView.setVisibility(View.INVISIBLE);
+        this.appView.useBrowserHistory = useBrowserHistory;
         root.addView(this.appView);
         setContentView(root);
         


Mime
View raw message