incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject [1/16] android commit: Tweaking DroidGap so it compiles into a JAR, starting testing
Date Tue, 10 Apr 2012 21:39:21 GMT
Updated Branches:
  refs/heads/CordovaWebView 527f17d19 -> 9a2eb0405


Tweaking DroidGap so it compiles into a JAR, starting testing


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

Branch: refs/heads/CordovaWebView
Commit: 9a2eb04054eb4d940c33eb479bfd0d33566daeb4
Parents: f34da8a
Author: Joe Bowser <bowserj@apache.org>
Authored: Tue Apr 10 14:39:01 2012 -0700
Committer: Joe Bowser <bowserj@apache.org>
Committed: Tue Apr 10 14:39:01 2012 -0700

----------------------------------------------------------------------
 framework/project.properties                       |    2 +-
 .../org/apache/cordova/CordovaChromeClient.java    |   32 +++++++++------
 .../org/apache/cordova/CordovaWebViewClient.java   |    4 +-
 framework/src/org/apache/cordova/DroidGap.java     |    2 +-
 4 files changed, 23 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/9a2eb040/framework/project.properties
----------------------------------------------------------------------
diff --git a/framework/project.properties b/framework/project.properties
index 247ca66..0c8710a 100644
--- a/framework/project.properties
+++ b/framework/project.properties
@@ -10,5 +10,5 @@
 # Indicates whether an apk should be generated for each density.
 split.density=false
 # Project target.
-target=android-14
+target=android-15
 apk-configurations=

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/9a2eb040/framework/src/org/apache/cordova/CordovaChromeClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaChromeClient.java b/framework/src/org/apache/cordova/CordovaChromeClient.java
index 8bf5208..95c8bc9 100755
--- a/framework/src/org/apache/cordova/CordovaChromeClient.java
+++ b/framework/src/org/apache/cordova/CordovaChromeClient.java
@@ -44,7 +44,7 @@ public class CordovaChromeClient extends WebChromeClient {
 
     private String TAG = "CordovaLog";
     private long MAX_QUOTA = 100 * 1024 * 1024;
-    private DroidGap ctx;
+    private Context ctx;
     private CordovaWebView appView;
     
     /**
@@ -53,8 +53,7 @@ public class CordovaChromeClient extends WebChromeClient {
      * @param ctx
      */
     public CordovaChromeClient(Context ctx) {
-        this.ctx = (DroidGap) ctx;
-        appView = this.ctx.appView;
+        this.ctx = ctx;
     }
     
     public CordovaChromeClient(Context ctx, CordovaWebView app)
@@ -173,10 +172,15 @@ public class CordovaChromeClient extends WebChromeClient {
     @Override
     public boolean onJsPrompt(WebView view, String url, String message, String defaultValue,
JsPromptResult result) {
         
+        if(appView == null)
+        {
+          appView = (CordovaWebView) view;
+        }
+        
         // Security check to make sure any requests are coming from the page initially
         // loaded in webview and not another loaded in an iframe.
         boolean reqOk = false;
-        if (url.startsWith("file://") || url.indexOf(this.ctx.baseUrl) == 0 || ctx.isUrlWhiteListed(url))
{
+        if (url.startsWith("file://") || appView.isUrlWhiteListed(url)) {
             reqOk = true;
         }
         
@@ -199,7 +203,9 @@ public class CordovaChromeClient extends WebChromeClient {
         
         // Polling for JavaScript messages 
         else if (reqOk && defaultValue != null && defaultValue.equals("gap_poll:"))
{
-            String r = ctx.callbackServer.getJavascript();
+            
+              
+            String r = appView.callbackServer.getJavascript();
             result.confirm(r);
         }
         
@@ -207,16 +213,16 @@ public class CordovaChromeClient extends WebChromeClient {
         else if (reqOk && defaultValue != null && defaultValue.equals("gap_callbackServer:"))
{
             String r = "";
             if (message.equals("usePolling")) {
-                r = ""+ ctx.callbackServer.usePolling();
+                r = ""+ appView.callbackServer.usePolling();
             }
             else if (message.equals("restartServer")) {
-                ctx.callbackServer.restartServer();
+                appView.callbackServer.restartServer();
             }
             else if (message.equals("getPort")) {
-                r = Integer.toString(ctx.callbackServer.getPort());
+                r = Integer.toString(appView.callbackServer.getPort());
             }
             else if (message.equals("getToken")) {
-                r = ctx.callbackServer.getToken();
+                r = appView.callbackServer.getToken();
             }
             result.confirm(r);
         }
@@ -224,11 +230,11 @@ public class CordovaChromeClient extends WebChromeClient {
         // Cordova JS has initialized, so show webview
         // (This solves white flash seen when rendering HTML)
         else if (reqOk && defaultValue != null && defaultValue.equals("gap_init:"))
{
-            if (ctx.splashscreen != 0) {
-                ctx.root.setBackgroundResource(0);
+            if (ctx.getClass().equals(DroidGap.class) && ((DroidGap) ctx).splashscreen
!= 0) {
+                ((DroidGap) ctx).root.setBackgroundResource(0);
+                ((DroidGap) ctx).spinnerStop();
             }
-            ctx.appView.setVisibility(View.VISIBLE);
-            ctx.spinnerStop();
+            appView.setVisibility(View.VISIBLE);
             result.confirm("OK");
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/9a2eb040/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 56f4a22..a10f3a7 100755
--- a/framework/src/org/apache/cordova/CordovaWebViewClient.java
+++ b/framework/src/org/apache/cordova/CordovaWebViewClient.java
@@ -256,8 +256,8 @@ public class CordovaWebViewClient extends WebViewClient {
 
         // Shutdown if blank loaded
         if (url.equals("about:blank")) {
-            if (this.ctx.callbackServer != null) {
-                this.ctx.callbackServer.destroy();
+            if (appView.callbackServer != null) {
+                appView.callbackServer.destroy();
             }
             this.ctx.endActivity();
         }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/9a2eb040/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 d6e64cd..f91e5a4 100755
--- a/framework/src/org/apache/cordova/DroidGap.java
+++ b/framework/src/org/apache/cordova/DroidGap.java
@@ -1,5 +1,5 @@
 /*
-       Licensed to the Apache Software Foundation (ASF) under one
+f       Licensed to the Apache Software Foundation (ASF) under one
        or more contributor license agreements.  See the NOTICE file
        distributed with this work for additional information
        regarding copyright ownership.  The ASF licenses this file


Mime
View raw message