incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From macdo...@apache.org
Subject [1/2] android commit: Fix issue with document.location.href not calling loadUrlIntoView
Date Wed, 22 Feb 2012 15:40:43 GMT
Updated Branches:
  refs/heads/master c9d427620 -> 363b1429e


Fix issue with document.location.href not calling loadUrlIntoView

Now we peek at the history and add the url the stack if loadUrlIntoView is not being called.


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

Branch: refs/heads/master
Commit: 363b1429e39515a4b11269a14439c7228dfd9b73
Parents: 900ff9e
Author: macdonst <simon.macdonald@gmail.com>
Authored: Mon Feb 13 18:41:06 2012 -0500
Committer: macdonst <simon.macdonald@gmail.com>
Committed: Wed Feb 22 10:19:47 2012 -0500

----------------------------------------------------------------------
 .../org/apache/cordova/CordovaWebViewClient.java   |   15 ++++-
 framework/src/org/apache/cordova/DroidGap.java     |   44 ++++++++------
 2 files changed, 36 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/363b1429/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 a5e5745..a44d23e 100755
--- a/framework/src/org/apache/cordova/CordovaWebViewClient.java
+++ b/framework/src/org/apache/cordova/CordovaWebViewClient.java
@@ -183,9 +183,6 @@ public class CordovaWebViewClient extends WebViewClient {
     
     @Override
     public void onPageStarted(WebView view, String url, Bitmap favicon) {
-        Log.d("CordovaWebViewClient", "I got a page started for = " + url);
-        Log.d("CordovaWebViewClient", "can go back " + view.canGoBack());
-
         // Clear history so history.back() doesn't do anything.  
         // So we can reinit() native side CallbackServer & PluginManager.
         view.clearHistory(); 
@@ -200,7 +197,6 @@ public class CordovaWebViewClient extends WebViewClient {
      */
     @Override
     public void onPageFinished(WebView view, String url) {
-        Log.d("CordovaWebViewClient", "I got a page finished for = " + url);
         super.onPageFinished(view, url);
 
         /**
@@ -296,4 +292,15 @@ public class CordovaWebViewClient extends WebViewClient {
             super.onReceivedSslError(view, handler, error);
         }
     }
+
+    @Override
+    public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) {
+        /* 
+         * If you do a document.location.href the url does not get pushed on the stack
+         * so we do a check here to see if the url should be pushed.
+         */
+        if (!this.ctx.peekAtUrlStack().equals(url)) {
+            this.ctx.pushUrl(url);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/363b1429/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 2bc6c38..8dc9fd7 100755
--- a/framework/src/org/apache/cordova/DroidGap.java
+++ b/framework/src/org/apache/cordova/DroidGap.java
@@ -33,8 +33,6 @@ import org.apache.cordova.api.IPlugin;
 import org.apache.cordova.api.LOG;
 import org.apache.cordova.api.CordovaInterface;
 import org.apache.cordova.api.PluginManager;
-import org.json.JSONArray;
-import org.json.JSONException;
 import org.xmlpull.v1.XmlPullParserException;
 
 import android.app.Activity;
@@ -43,17 +41,12 @@ import android.app.ProgressDialog;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.res.Configuration;
 import android.content.res.XmlResourceParser;
 import android.database.Cursor;
-import android.graphics.Bitmap;
 import android.graphics.Color;
 import android.media.AudioManager;
 import android.net.Uri;
-import android.net.http.SslError;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.Display;
@@ -64,19 +57,10 @@ import android.view.View;
 import android.view.ViewGroup;
 import android.view.Window;
 import android.view.WindowManager;
-import android.webkit.ConsoleMessage;
-import android.webkit.GeolocationPermissions.Callback;
-import android.webkit.HttpAuthHandler;
-import android.webkit.JsPromptResult;
-import android.webkit.JsResult;
-import android.webkit.SslErrorHandler;
-import android.webkit.WebChromeClient;
 import android.webkit.WebSettings;
 import android.webkit.WebSettings.LayoutAlgorithm;
-import android.webkit.WebStorage;
 import android.webkit.WebView;
 import android.webkit.WebViewClient;
-import android.widget.EditText;
 import android.widget.LinearLayout;
 
 
@@ -229,8 +213,6 @@ public class DroidGap extends Activity implements CordovaInterface {
     // preferences read from cordova.xml
     protected PreferenceSet preferences;
 
-    private boolean classicRender;
-
     /**
      * Sets the authentication token.
      * 
@@ -1370,7 +1352,31 @@ public class DroidGap extends Activity implements CordovaInterface
{
         }
         return false;
     }
-
+    
+    /*
+     * URL stack manipulators
+     */
+    
+    /** 
+     * Returns the top url on the stack without removing it from 
+     * the stack.
+     */
+    public String peekAtUrlStack() {
+        if (urls.size() > 0) {
+            return urls.peek();
+        }
+        return "";
+    }
+    
+    /**
+     * Add a url to the stack
+     * 
+     * @param url
+     */
+    public void pushUrl(String url) {
+        urls.push(url);
+    }
+    
     /* 
      * Hook in DroidGap for menu plugins
      * 


Mime
View raw message