diff --git a/framework/project.properties b/framework/project.properties index 247ca66ed..0c8710a79 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= diff --git a/framework/src/org/apache/cordova/CordovaChromeClient.java b/framework/src/org/apache/cordova/CordovaChromeClient.java index 8bf5208fa..95c8bc9d2 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"); } diff --git a/framework/src/org/apache/cordova/CordovaWebViewClient.java b/framework/src/org/apache/cordova/CordovaWebViewClient.java index 56f4a220d..a10f3a7a1 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(); } diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java index d6e64cdb5..f91e5a486 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