From cdfa13b2657bf60bc0e5b80ca4b98a58e490a74f Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Mon, 29 Sep 2014 14:59:07 -0700 Subject: [PATCH 1/6] Update JS snapshot to version 3.7.0-dev (via coho) --- framework/assets/www/cordova.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/framework/assets/www/cordova.js b/framework/assets/www/cordova.js index c9e69350..a7773569 100644 --- a/framework/assets/www/cordova.js +++ b/framework/assets/www/cordova.js @@ -1,5 +1,5 @@ // Platform: android -// 3.7.0-dev-1258511 +// 8ca0f3b2b87e0759c5236b91c80f18438544409c /* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file @@ -19,7 +19,7 @@ under the License. */ ;(function() { -var CORDOVA_JS_BUILD_LABEL = '3.7.0-dev-1258511'; +var PLATFORM_VERSION_BUILD_LABEL = '3.7.0-dev'; // file: src/scripts/require.js /*jshint -W079 */ @@ -175,7 +175,8 @@ function createEvent(type, data) { var cordova = { define:define, require:require, - version:CORDOVA_JS_BUILD_LABEL, + version:PLATFORM_VERSION_BUILD_LABEL, + platformVersion:PLATFORM_VERSION_BUILD_LABEL, platformId:platform.id, /** * Methods to add/remove your own addEventListener hijacking on document + window. @@ -1183,6 +1184,16 @@ function replaceNavigator(origNavigator) { for (var key in origNavigator) { if (typeof origNavigator[key] == 'function') { newNavigator[key] = origNavigator[key].bind(origNavigator); + } else { + (function(k) { + Object.defineProperty(newNavigator, k, { + get: function() { + return origNavigator[k]; + }, + configurable: true, + enumerable: true + }); + })(key); } } } @@ -1302,6 +1313,16 @@ function replaceNavigator(origNavigator) { for (var key in origNavigator) { if (typeof origNavigator[key] == 'function') { newNavigator[key] = origNavigator[key].bind(origNavigator); + } else { + (function(k) { + Object.defineProperty(newNavigator, k, { + get: function() { + return origNavigator[k]; + }, + configurable: true, + enumerable: true + }); + })(key); } } } From d5538b707628937b78a054ce3a6692e640e66a4b Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Mon, 29 Sep 2014 23:49:12 -0700 Subject: [PATCH 2/6] updated .gitignore to include npm-debug.log --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6f19b35a..f2c38286 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ Desktop.ini # IntelliJ IDEA files *.iml .idea +npm-debug.log From ce7d6d69d99cb5c398fc1b2b5f99503ba23edd60 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Tue, 30 Sep 2014 13:10:16 -0700 Subject: [PATCH 3/6] updated release notes --- RELEASENOTES.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 43bb3265..fb0a709c 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -20,6 +20,17 @@ --> ## Release Notes for Cordova (Android) ## +### 3.6.4 (Sept 30, 2014) ### + +* Set VERSION to 3.6.4 (via coho) +* Update JS snapshot to version 3.6.4 (via coho) +* CB-7634 Detect JAVA_HOME properly on Ubuntu +* CB-7579 Fix run script's ability to use non-arch-specific APKs +* CB-6511 Fixes build for android when app name contains unicode characters. +* CB-7463: Adding licences. I don't know what the gradle syntax is for comments, that still needs to be done. +* CB-7463: Looked at the Apache BigTop git, gradle uses C-style comments +* CB-7460: Fixing bug with KitKat where the background colour would override the CSS colours on the application + ### 3.6.0 (Sept 2014) ### * Set VERSION to 3.6.0 (via coho) From c255a849411826e98d4cbc9b4c3211cb23e8d6b8 Mon Sep 17 00:00:00 2001 From: Marcel Kinard Date: Tue, 30 Sep 2014 18:37:10 -0400 Subject: [PATCH 4/6] CB-7674 move preference activation back into onCreate() The preference creation actually needs to be before super.onCreate(savedInstance) in order to avoid the exception "requestFeature() must be called before adding content". Also ran into an issue in the native tests "Whitelist" and "User WebView/Client/Chrome" where it would throw an exception that the CordovaWebView appView already had a parent and needed to be removed from that parent before the invocation to root.addView(appView). So I conditionally remove the wrong parent. Also made a change to the native tests so the menus test would work. I also put super.init() back into the template, though invoking it is optional as loadUrl will call it automatically if needed. --- bin/templates/project/Activity.java | 1 + .../org/apache/cordova/CordovaActivity.java | 55 ++++++++++++------- test/res/xml/config.xml | 1 + test/src/org/apache/cordova/test/menus.java | 3 +- 4 files changed, 37 insertions(+), 23 deletions(-) diff --git a/bin/templates/project/Activity.java b/bin/templates/project/Activity.java index 1bd9e1cb..55395197 100644 --- a/bin/templates/project/Activity.java +++ b/bin/templates/project/Activity.java @@ -28,6 +28,7 @@ public class __ACTIVITY__ extends CordovaActivity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + super.init(); // Set by in config.xml loadUrl(launchUrl); } diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java index bf1fd6a4..3c12a97a 100755 --- a/framework/src/org/apache/cordova/CordovaActivity.java +++ b/framework/src/org/apache/cordova/CordovaActivity.java @@ -49,6 +49,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.view.ViewParent; import android.view.Window; import android.view.WindowManager; import android.webkit.ValueCallback; @@ -72,6 +73,7 @@ import android.widget.LinearLayout; * @Override * public void onCreate(Bundle savedInstanceState) { * super.onCreate(savedInstanceState); + * super.init(); * // Load your application * loadUrl(launchUrl); * } @@ -200,14 +202,33 @@ public class CordovaActivity extends Activity implements CordovaInterface { public void onCreate(Bundle savedInstanceState) { LOG.i(TAG, "Apache Cordova native platform version " + CordovaWebView.CORDOVA_VERSION + " is starting"); LOG.d(TAG, "CordovaActivity.onCreate()"); + + // need to activate preferences before super.onCreate to avoid "requestFeature() must be called before adding content" exception + loadConfig(); + if(!preferences.getBoolean("ShowTitle", false)) + { + getWindow().requestFeature(Window.FEATURE_NO_TITLE); + } + + if(preferences.getBoolean("SetFullscreen", false)) + { + Log.d(TAG, "The SetFullscreen configuration is deprecated in favor of Fullscreen, and will be removed in a future version."); + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, + WindowManager.LayoutParams.FLAG_FULLSCREEN); + } else if (preferences.getBoolean("Fullscreen", false)) { + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, + WindowManager.LayoutParams.FLAG_FULLSCREEN); + } else { + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, + WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); + } + super.onCreate(savedInstanceState); if(savedInstanceState != null) { initCallbackClass = savedInstanceState.getString("callbackClass"); } - - loadConfig(); } @SuppressWarnings("deprecation") @@ -227,7 +248,9 @@ public class CordovaActivity extends Activity implements CordovaInterface { @SuppressWarnings("deprecation") protected void createViews() { // This builds the view. We could probably get away with NOT having a LinearLayout, but I like having a bucket! - // This builds the view. We could probably get away with NOT having a LinearLayout, but I like having a bucket! + + LOG.d(TAG, "CordovaActivity.createViews()"); + Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight(); @@ -245,6 +268,14 @@ public class CordovaActivity extends Activity implements CordovaInterface { // Add web view but make it invisible while loading URL appView.setVisibility(View.INVISIBLE); + + // need to remove appView from any existing parent before invoking root.addView(appView) + ViewParent parent = appView.getParent(); + if ((parent != null) && (parent != root)) { + LOG.d(TAG, "removing appView from existing parent"); + ViewGroup parentGroup = (ViewGroup) parent; + parentGroup.removeView(appView); + } root.addView((View) appView); setContentView(root); @@ -302,24 +333,6 @@ public class CordovaActivity extends Activity implements CordovaInterface { public void init(CordovaWebView webView, CordovaWebViewClient webViewClient, CordovaChromeClient webChromeClient) { LOG.d(TAG, "CordovaActivity.init()"); - if(!preferences.getBoolean("ShowTitle", false)) - { - getWindow().requestFeature(Window.FEATURE_NO_TITLE); - } - - if(preferences.getBoolean("SetFullscreen", false)) - { - Log.d(TAG, "The SetFullscreen configuration is deprecated in favor of Fullscreen, and will be removed in a future version."); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FULLSCREEN); - } else if (preferences.getBoolean("Fullscreen", false)) { - getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FULLSCREEN); - } else { - getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); - } - appView = webView != null ? webView : makeWebView(); if (appView.pluginManager == null) { appView.init(this, webViewClient != null ? webViewClient : makeWebViewClient(appView), diff --git a/test/res/xml/config.xml b/test/res/xml/config.xml index 148bad5a..4370357c 100644 --- a/test/res/xml/config.xml +++ b/test/res/xml/config.xml @@ -34,6 +34,7 @@ + diff --git a/test/src/org/apache/cordova/test/menus.java b/test/src/org/apache/cordova/test/menus.java index 6d0d3f1a..9bde03e9 100755 --- a/test/src/org/apache/cordova/test/menus.java +++ b/test/src/org/apache/cordova/test/menus.java @@ -32,8 +32,7 @@ public class menus extends CordovaActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // need the title to be shown for the options menu to be visible - preferences.set("showTitle", true); + // need the title to be shown (config.xml) for the options menu to be visible super.init(); super.registerForContextMenu(super.appView); super.loadUrl("file:///android_asset/www/menus/index.html"); From 6cbf6b78751f78c62752e8d65df14d448d9eb6c9 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Tue, 30 Sep 2014 17:57:42 -0700 Subject: [PATCH 5/6] CB-7674: Added sleep to avoid null error after most recent change to not break API --- .../src/org/apache/cordova/test/junit/IntentUriOverrideTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/test/src/org/apache/cordova/test/junit/IntentUriOverrideTest.java b/test/src/org/apache/cordova/test/junit/IntentUriOverrideTest.java index 559bcc78..e84a8dca 100644 --- a/test/src/org/apache/cordova/test/junit/IntentUriOverrideTest.java +++ b/test/src/org/apache/cordova/test/junit/IntentUriOverrideTest.java @@ -75,6 +75,7 @@ public class IntentUriOverrideTest extends ActivityInstrumentationTestCase2 Date: Fri, 3 Oct 2014 00:47:13 -0500 Subject: [PATCH 6/6] CB-6837 Fix leaked window when hitting back button while alert being rendered Keep track of the last AlertDialog showed. The last dialog showed that is rendered while hitting back button it causes a leaked window. Instead of perform a full track of all dialogs created, only destroy the last one showed, this fixes the problem. close #122 --- .../org/apache/cordova/CordovaChromeClient.java | 16 +++++++++++++--- .../src/org/apache/cordova/CordovaWebView.java | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/framework/src/org/apache/cordova/CordovaChromeClient.java b/framework/src/org/apache/cordova/CordovaChromeClient.java index 737d0b84..ff0c0f2f 100755 --- a/framework/src/org/apache/cordova/CordovaChromeClient.java +++ b/framework/src/org/apache/cordova/CordovaChromeClient.java @@ -65,6 +65,9 @@ public class CordovaChromeClient extends WebChromeClient { // the video progress view private View mVideoProgressView; + //Keep track of last AlertDialog showed + private AlertDialog lastHandledDialog; + // File Chooser public ValueCallback mUploadMessage; @@ -123,7 +126,7 @@ public class CordovaChromeClient extends WebChromeClient { return true; } }); - dlg.show(); + lastHandledDialog = dlg.show(); return true; } @@ -172,7 +175,7 @@ public class CordovaChromeClient extends WebChromeClient { return true; } }); - dlg.show(); + lastHandledDialog = dlg.show(); return true; } @@ -216,7 +219,7 @@ public class CordovaChromeClient extends WebChromeClient { res.cancel(); } }); - dlg.show(); + lastHandledDialog = dlg.show(); } return true; } @@ -328,4 +331,11 @@ public class CordovaChromeClient extends WebChromeClient { public ValueCallback getValueCallback() { return this.mUploadMessage; } + + public void destroyLastDialog(){ + if(lastHandledDialog != null){ + lastHandledDialog.cancel(); + } + } + } diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index f7a94ae2..862f2ded 100755 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -788,6 +788,9 @@ public class CordovaWebView extends WebView { // Load blank page so that JavaScript onunload is called this.loadUrl("about:blank"); + + //Remove last AlertDialog + this.chromeClient.destroyLastDialog(); // Forward to plugins if (this.pluginManager != null) {