forked from github/cordova-android
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a67bddbd82 | ||
![]() |
81eb8ff1f9 | ||
![]() |
8de13d9af5 | ||
![]() |
83118456cc | ||
![]() |
8eaa71d9b7 | ||
![]() |
554b599912 | ||
![]() |
82528f3973 | ||
![]() |
4ca80030ce | ||
![]() |
a102d1d23a | ||
![]() |
6e495259b2 | ||
![]() |
6b7eaf2386 | ||
![]() |
1d7c033e52 | ||
![]() |
f224b1f2d4 | ||
![]() |
4ac6916dd0 | ||
![]() |
a31107e389 |
@ -20,6 +20,14 @@
|
||||
-->
|
||||
## Release Notes for Cordova (Android) ##
|
||||
|
||||
### Release 4.0.2 (May 2015) ###
|
||||
|
||||
* Removed Intent Functionality from Preferences - Preferences can no longer be set by intents
|
||||
|
||||
### Release 4.0.1 (April 2015) ###
|
||||
|
||||
* Bug fixed where platform failed to install on a version downgrade
|
||||
|
||||
### Release 4.0.0 (March 2015) ###
|
||||
|
||||
This release adds significant functionality, and also introduces a number
|
||||
|
2
bin/templates/cordova/lib/device.js
vendored
2
bin/templates/cordova/lib/device.js
vendored
@ -98,7 +98,7 @@ module.exports.install = function(target, buildResults) {
|
||||
var launchName = appinfo.getActivityName();
|
||||
console.log('Using apk: ' + apk_path);
|
||||
console.log('Installing app on device...');
|
||||
var cmd = 'adb -s ' + resolvedTarget.target + ' install -r "' + apk_path + '"';
|
||||
var cmd = 'adb -s ' + resolvedTarget.target + ' install -r -d "' + apk_path + '"';
|
||||
return exec(cmd, os.tmpdir())
|
||||
.then(function(output) {
|
||||
if (output.match(/Failure/)) return Q.reject('ERROR: Failed to install apk to device: ' + output);
|
||||
|
2
bin/templates/cordova/lib/emulator.js
vendored
2
bin/templates/cordova/lib/emulator.js
vendored
@ -308,7 +308,7 @@ module.exports.install = function(target, buildResults) {
|
||||
var apk_path = build.findBestApkForArchitecture(buildResults, resolvedTarget.arch);
|
||||
console.log('Installing app on emulator...');
|
||||
console.log('Using apk: ' + apk_path);
|
||||
return exec('adb -s ' + resolvedTarget.target + ' install -r "' + apk_path + '"', os.tmpdir())
|
||||
return exec('adb -s ' + resolvedTarget.target + ' install -r -d "' + apk_path + '"', os.tmpdir())
|
||||
.then(function(output) {
|
||||
if (output.match(/Failure/)) {
|
||||
return Q.reject('Failed to install apk to emulator: ' + output);
|
||||
|
@ -20,6 +20,6 @@
|
||||
*/
|
||||
|
||||
// Coho updates this line:
|
||||
var VERSION = "4.0.0-dev";
|
||||
var VERSION = "4.0.2";
|
||||
|
||||
console.log(VERSION);
|
||||
|
19
bin/templates/project/assets/www/cordova.js
vendored
19
bin/templates/project/assets/www/cordova.js
vendored
@ -1,5 +1,5 @@
|
||||
// Platform: android
|
||||
// fc4db9145934bd0053161cbf9ffc0caf83b770c6
|
||||
// 23738581906992092a43ad2e643b1e0c43bba38a
|
||||
/*
|
||||
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 PLATFORM_VERSION_BUILD_LABEL = '4.0.0-dev';
|
||||
var PLATFORM_VERSION_BUILD_LABEL = '4.0.2';
|
||||
// file: src/scripts/require.js
|
||||
|
||||
/*jshint -W079 */
|
||||
@ -101,10 +101,15 @@ if (typeof module === "object" && typeof require === "function") {
|
||||
// file: src/cordova.js
|
||||
define("cordova", function(require, exports, module) {
|
||||
|
||||
if(window.cordova){
|
||||
throw new Error("cordova already defined");
|
||||
}
|
||||
|
||||
|
||||
var channel = require('cordova/channel');
|
||||
var platform = require('cordova/platform');
|
||||
|
||||
|
||||
/**
|
||||
* Intercept calls to addEventListener + removeEventListener and handle deviceready,
|
||||
* resume, and pause events.
|
||||
@ -323,7 +328,7 @@ module.exports = cordova;
|
||||
|
||||
});
|
||||
|
||||
// file: src/android/android/nativeapiprovider.js
|
||||
// file: node_modules/cordova-android/cordova-js-src/android/nativeapiprovider.js
|
||||
define("cordova/android/nativeapiprovider", function(require, exports, module) {
|
||||
|
||||
/**
|
||||
@ -346,7 +351,7 @@ module.exports = {
|
||||
|
||||
});
|
||||
|
||||
// file: src/android/android/promptbasednativeapi.js
|
||||
// file: node_modules/cordova-android/cordova-js-src/android/promptbasednativeapi.js
|
||||
define("cordova/android/promptbasednativeapi", function(require, exports, module) {
|
||||
|
||||
/**
|
||||
@ -856,7 +861,7 @@ module.exports = channel;
|
||||
|
||||
});
|
||||
|
||||
// file: src/android/exec.js
|
||||
// file: node_modules/cordova-android/cordova-js-src/exec.js
|
||||
define("cordova/exec", function(require, exports, module) {
|
||||
|
||||
/**
|
||||
@ -1499,7 +1504,7 @@ exports.reset();
|
||||
|
||||
});
|
||||
|
||||
// file: src/android/platform.js
|
||||
// file: node_modules/cordova-android/cordova-js-src/platform.js
|
||||
define("cordova/platform", function(require, exports, module) {
|
||||
|
||||
module.exports = {
|
||||
@ -1575,7 +1580,7 @@ function onMessageFromNative(msg) {
|
||||
|
||||
});
|
||||
|
||||
// file: src/android/plugin/android/app.js
|
||||
// file: node_modules/cordova-android/cordova-js-src/plugin/android/app.js
|
||||
define("cordova/plugin/android/app", function(require, exports, module) {
|
||||
|
||||
var exec = require('cordova/exec');
|
||||
|
@ -36,8 +36,8 @@ public class Config {
|
||||
public static void init(Activity action) {
|
||||
parser = new ConfigXmlParser();
|
||||
parser.parse(action);
|
||||
//TODO: Add feature to bring this back. Some preferences should be overridden by intents, but not all
|
||||
parser.getPreferences().setPreferencesBundle(action.getIntent().getExtras());
|
||||
parser.getPreferences().copyIntoIntentExtras(action);
|
||||
}
|
||||
|
||||
// Intended to be used for testing only; creates an empty configuration.
|
||||
|
@ -152,7 +152,6 @@ public class CordovaActivity extends Activity {
|
||||
parser.parse(this);
|
||||
preferences = parser.getPreferences();
|
||||
preferences.setPreferencesBundle(getIntent().getExtras());
|
||||
preferences.copyIntoIntentExtras(this);
|
||||
launchUrl = parser.getLaunchUrl();
|
||||
pluginEntries = parser.getPluginEntries();
|
||||
Config.parser = parser;
|
||||
|
@ -61,13 +61,6 @@ public class CordovaPreferences {
|
||||
String value = prefs.get(name);
|
||||
if (value != null) {
|
||||
return Boolean.parseBoolean(value);
|
||||
} else if (preferencesBundleExtras != null) {
|
||||
Object bundleValue = preferencesBundleExtras.get(name);
|
||||
if (bundleValue instanceof String) {
|
||||
return "true".equals(bundleValue);
|
||||
}
|
||||
// Gives a nice warning if type is wrong.
|
||||
return preferencesBundleExtras.getBoolean(name, defaultValue);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
@ -83,13 +76,6 @@ public class CordovaPreferences {
|
||||
if (value != null) {
|
||||
// Use Integer.decode() can't handle it if the highest bit is set.
|
||||
return (int)(long)Long.decode(value);
|
||||
} else if (preferencesBundleExtras != null) {
|
||||
Object bundleValue = preferencesBundleExtras.get(name);
|
||||
if (bundleValue instanceof String) {
|
||||
return Integer.valueOf((String)bundleValue);
|
||||
}
|
||||
// Gives a nice warning if type is wrong.
|
||||
return preferencesBundleExtras.getInt(name, defaultValue);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
@ -99,13 +85,6 @@ public class CordovaPreferences {
|
||||
String value = prefs.get(name);
|
||||
if (value != null) {
|
||||
return Double.valueOf(value);
|
||||
} else if (preferencesBundleExtras != null) {
|
||||
Object bundleValue = preferencesBundleExtras.get(name);
|
||||
if (bundleValue instanceof String) {
|
||||
return Double.valueOf((String)bundleValue);
|
||||
}
|
||||
// Gives a nice warning if type is wrong.
|
||||
return preferencesBundleExtras.getDouble(name, defaultValue);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
@ -115,69 +94,8 @@ public class CordovaPreferences {
|
||||
String value = prefs.get(name);
|
||||
if (value != null) {
|
||||
return value;
|
||||
} else if (preferencesBundleExtras != null && !"errorurl".equals(name)) {
|
||||
Object bundleValue = preferencesBundleExtras.get(name);
|
||||
if (bundleValue != null) {
|
||||
return bundleValue.toString();
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
// Plugins should not rely on values within the intent since this does not work
|
||||
// for apps with multiple webviews. Instead, they should retrieve prefs from the
|
||||
// Config object associated with their webview.
|
||||
public void copyIntoIntentExtras(Activity action) {
|
||||
for (String name : prefs.keySet()) {
|
||||
String value = prefs.get(name);
|
||||
if (value == null) {
|
||||
continue;
|
||||
}
|
||||
if (name.equals("loglevel")) {
|
||||
LOG.setLogLevel(value);
|
||||
} else if (name.equals("splashscreen")) {
|
||||
// Note: We should probably pass in the classname for the variable splash on splashscreen!
|
||||
int resource = action.getResources().getIdentifier(value, "drawable", action.getClass().getPackage().getName());
|
||||
if(resource == 0) {
|
||||
resource = action.getResources().getIdentifier(value, "drawable", action.getPackageName());
|
||||
}
|
||||
action.getIntent().putExtra(name, resource);
|
||||
}
|
||||
else if(name.equals("backgroundcolor")) {
|
||||
int asInt = (int)(long)Long.decode(value);
|
||||
action.getIntent().putExtra(name, asInt);
|
||||
}
|
||||
else if(name.equals("loadurltimeoutvalue")) {
|
||||
int asInt = Integer.decode(value);
|
||||
action.getIntent().putExtra(name, asInt);
|
||||
}
|
||||
else if(name.equals("splashscreendelay")) {
|
||||
int asInt = Integer.decode(value);
|
||||
action.getIntent().putExtra(name, asInt);
|
||||
}
|
||||
else if(name.equals("keeprunning"))
|
||||
{
|
||||
boolean asBool = Boolean.parseBoolean(value);
|
||||
action.getIntent().putExtra(name, asBool);
|
||||
}
|
||||
else if(name.equals("inappbrowserstorageenabled"))
|
||||
{
|
||||
boolean asBool = Boolean.parseBoolean(value);
|
||||
action.getIntent().putExtra(name, asBool);
|
||||
}
|
||||
else if(name.equals("disallowoverscroll"))
|
||||
{
|
||||
boolean asBool = Boolean.parseBoolean(value);
|
||||
action.getIntent().putExtra(name, asBool);
|
||||
}
|
||||
else
|
||||
{
|
||||
action.getIntent().putExtra(name, value);
|
||||
}
|
||||
}
|
||||
// In the normal case, the intent extras are null until the first call to putExtra().
|
||||
if (preferencesBundleExtras == null) {
|
||||
preferencesBundleExtras = action.getIntent().getExtras();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import android.webkit.WebChromeClient.CustomViewCallback;
|
||||
* are not expected to implement it.
|
||||
*/
|
||||
public interface CordovaWebView {
|
||||
public static final String CORDOVA_VERSION = "4.0.0-dev";
|
||||
public static final String CORDOVA_VERSION = "4.0.2";
|
||||
|
||||
void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cordova-android",
|
||||
"version": "4.0.0-dev",
|
||||
"version": "4.0.2",
|
||||
"description": "cordova-android release",
|
||||
"main": "bin/create",
|
||||
"repository": {
|
||||
|
@ -24,7 +24,7 @@ package org.apache.cordova.test;
|
||||
public class ErrorUrlTest extends BaseCordovaIntegrationTest {
|
||||
private static final String START_URL = "file:///android_asset/www/htmlnotfound/index.html";
|
||||
private static final String ERROR_URL = "file:///android_asset/www/htmlnotfound/error.html";
|
||||
private static final String INVALID_URL = "file:///android_asset/www/index.html";
|
||||
private static final String INVALID_URL = "file:///android_asset/www/invalid.html";
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
@ -31,10 +31,9 @@ public class HtmlNotFoundTest extends BaseCordovaIntegrationTest {
|
||||
public void testUrl() throws Throwable
|
||||
{
|
||||
assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
|
||||
// TODO: Should this be null? Or some other way to indicate it didn't actually load?
|
||||
runTestOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
assertEquals(START_URL, testActivity.getCordovaWebView().getUrl());
|
||||
assertFalse(START_URL.equals(testActivity.getCordovaWebView().getUrl()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package org.apache.cordova.test;
|
||||
/*
|
||||
*
|
||||
* 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
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import org.apache.cordova.CordovaPreferences;
|
||||
|
||||
public class IntentPreferenceTest extends BaseCordovaIntegrationTest {
|
||||
private static final String GREEN = Integer.toHexString(Color.GREEN);
|
||||
private static final String START_URL = "file:///android_asset/www/index.html";
|
||||
|
||||
CordovaPreferences prefs;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
// INVALID_URL tests that errorUrl and url are *not* settable via the intent.
|
||||
setUpWithStartUrl(START_URL, "backgroundcolor", GREEN);
|
||||
prefs = cordovaWebView.getPreferences();
|
||||
}
|
||||
|
||||
public void testUrl() throws Throwable {
|
||||
assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
|
||||
assertFalse(prefs.getInteger("backgroundcolor", Color.BLACK) == Color.GREEN);
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ public class MainTestActivity extends BaseTestCordovaActivity {
|
||||
|
||||
@Override protected void loadConfig() {
|
||||
super.loadConfig();
|
||||
// Need to set this explicitly in prefs since it's not settable via bundle extras (for security reasons).
|
||||
// Need to set this explicitly in prefs since it's not settable via bundle extras.
|
||||
String errorUrl = getIntent().getStringExtra("testErrorUrl");
|
||||
if (errorUrl != null) {
|
||||
preferences.set("errorUrl", errorUrl);
|
||||
|
Loading…
Reference in New Issue
Block a user