diff --git a/.reviewboardrc b/.reviewboardrc
new file mode 100644
index 00000000..30e9587a
--- /dev/null
+++ b/.reviewboardrc
@@ -0,0 +1,8 @@
+#
+# Settings for post-review (used for uploading diffs to reviews.apache.org).
+#
+GUESS_FIELDS = True
+OPEN_BROWSER = True
+TARGET_GROUPS = 'cordova'
+REVIEWBOARD_URL = 'http://reviews.apache.org'
+
diff --git a/README.md b/README.md
index 5d2f7ded..00745595 100755
--- a/README.md
+++ b/README.md
@@ -1,3 +1,23 @@
+
Cordova Android
===
@@ -14,25 +34,8 @@ Requires
- Java JDK 1.5 or greater
- Apache ANT 1.8.0 or greater
- Android SDK [http://developer.android.com](http://developer.android.com)
-- Apache Commons Codec [http://commons.apache.org/codec/](http://commons.apache.org/codec/)
-Test Requirements
----
-- JUnit - [https://github.com/KentBeck/junit](https://github.com/KentBeck/junit)
-Building
----
-
-To create your `cordova.jar` file, copy the commons codec:
-
- mv commons-codec-1.7.jar framework/libs
-
-then run in the framework directory:
-
- android update project -p . -t android-17
- ant jar
-
-
Cordova Android Developer Tools
---
@@ -93,6 +96,18 @@ Importing a Cordova Android Project into Eclipse
5. Right click on the project root: Run as > Run Configurations
6. Click on the Target tab and select Manual (this way you can choose the emulator or device to build to)
+Building without the Tooling
+---
+Note: The Developer Tools handle this. This is only to be done if the tooling fails, or if
+you are developing directly against the framework.
+
+
+To create your `cordova.jar` file, run in the framework directory:
+
+ android update project -p . -t android-17
+ ant jar
+
+
Running Tests
----
Please see details under test/README.md.
@@ -101,5 +116,5 @@ Further Reading
---
- [http://developer.android.com](http://developer.android.com)
-- [http://incubator.apache.org/cordova/](http://incubator.apache.org/cordova/)
+- [http://cordova.apache.org/](http://cordova.apache.org)
- [http://wiki.apache.org/cordova/](http://wiki.apache.org/cordova/)
diff --git a/bin/check_reqs.bat b/bin/check_reqs.bat
index 65514c85..12da1e74 100644
--- a/bin/check_reqs.bat
+++ b/bin/check_reqs.bat
@@ -1,3 +1,20 @@
+:: 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.
+
@ECHO OFF
SET full_path=%~dp0
IF EXIST %full_path%check_reqs.js (
@@ -6,4 +23,4 @@ IF EXIST %full_path%check_reqs.js (
ECHO.
ECHO ERROR: Could not find 'check_reqs.js' in 'bin' folder, aborting...>&2
EXIT /B 1
-)
\ No newline at end of file
+)
diff --git a/bin/create b/bin/create
index 39aff6b8..134100dd 100755
--- a/bin/create
+++ b/bin/create
@@ -99,16 +99,6 @@ then
# update the cordova-android framework for the desired target
"$ANDROID_BIN" update project --target $TARGET --path "$BUILD_PATH"/framework &> /dev/null
- if [ ! -e "$BUILD_PATH"/framework/libs/commons-codec-1.7.jar ]; then
- # Use curl to get the jar (TODO: Support Apache Mirrors)
- curl -OL http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.7-bin.zip &> /dev/null
- unzip commons-codec-1.7-bin.zip &> /dev/null
- mkdir -p "$BUILD_PATH"/framework/libs
- cp commons-codec-1.7/commons-codec-1.7.jar "$BUILD_PATH"/framework/libs
- # cleanup yo
- rm commons-codec-1.7-bin.zip && rm -rf commons-codec-1.7
- fi
-
# compile cordova.js and cordova.jar
pushd "$BUILD_PATH"/framework > /dev/null
ant jar > /dev/null
@@ -153,6 +143,7 @@ cp "$BUILD_PATH"/bin/templates/cordova/build "$PROJECT_PATH"/cordova/build
cp "$BUILD_PATH"/bin/templates/cordova/clean "$PROJECT_PATH"/cordova/clean
cp "$BUILD_PATH"/bin/templates/cordova/log "$PROJECT_PATH"/cordova/log
cp "$BUILD_PATH"/bin/templates/cordova/run "$PROJECT_PATH"/cordova/run
+cp "$BUILD_PATH"/bin/templates/cordova/version "$PROJECT_PATH"/cordova/version
cp "$BUILD_PATH"/bin/templates/cordova/lib/cordova "$PROJECT_PATH"/cordova/lib/cordova
cp "$BUILD_PATH"/bin/templates/cordova/lib/install-device "$PROJECT_PATH"/cordova/lib/install-device
cp "$BUILD_PATH"/bin/templates/cordova/lib/install-emulator "$PROJECT_PATH"/cordova/lib/install-emulator
diff --git a/bin/create.js b/bin/create.js
index b1de5fe1..07c2e569 100644
--- a/bin/create.js
+++ b/bin/create.js
@@ -120,46 +120,6 @@ function cleanup() {
}
}
-function downloadCommonsCodec() {
- if (!fso.FileExists(ROOT + '\\framework\\libs\\commons-codec-1.7.jar')) {
- // We need the .jar
- var url = 'http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.7-bin.zip';
- var libsPath = ROOT + '\\framework\\libs';
- var savePath = libsPath + '\\commons-codec-1.7-bin.zip';
- if (!fso.FileExists(savePath)) {
- if(!fso.FolderExists(ROOT + '\\framework\\libs')) {
- fso.CreateFolder(libsPath);
- }
- // We need the zip to get the jar
- var xhr = WScript.CreateObject('MSXML2.XMLHTTP');
- xhr.open('GET', url, false);
- xhr.send();
- if (xhr.status == 200) {
- var stream = WScript.CreateObject('ADODB.Stream');
- stream.Open();
- stream.Type = 1;
- stream.Write(xhr.ResponseBody);
- stream.Position = 0;
- stream.SaveToFile(savePath);
- stream.Close();
- } else {
- Log('Could not retrieve the commons-codec. Please download it yourself and put into the framework/libs directory. This process may fail now. Sorry.');
- }
- }
- var app = WScript.CreateObject('Shell.Application');
- var source = app.NameSpace(savePath).Items();
- var target = app.NameSpace(ROOT + '\\framework\\libs');
- target.CopyHere(source, 256);
-
- // Move the jar into libs
- fso.MoveFile(ROOT + '\\framework\\libs\\commons-codec-1.7\\commons-codec-1.7.jar', ROOT + '\\framework\\libs\\commons-codec-1.7.jar');
-
- // Clean up
- fso.DeleteFile(ROOT + '\\framework\\libs\\commons-codec-1.7-bin.zip');
- fso.DeleteFolder(ROOT + '\\framework\\libs\\commons-codec-1.7', true);
- }
-}
-
// working dir
var ROOT = WScript.ScriptFullName.split('\\bin\\create.js').join('');
if (args.Count() > 0) {
@@ -206,8 +166,6 @@ if (!fso.FileExists(ROOT+'\\cordova-'+VERSION+'.jar') &&
Log("Building jar and js files...");
// update the cordova framework project to a target that exists on this machine
exec('android.bat update project --target "'+TARGET+'" --path "'+ROOT+'\\framework"');
- // pull down commons codec if necessary
- downloadCommonsCodec();
exec('ant.bat -f "'+ ROOT +'\\framework\\build.xml" jar');
}
diff --git a/bin/templates/cordova/build.bat b/bin/templates/cordova/build.bat
index 7aa7c75d..392f374a 100644
--- a/bin/templates/cordova/build.bat
+++ b/bin/templates/cordova/build.bat
@@ -1,2 +1,18 @@
+:: 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.
@ECHO OFF
-%~dp0\cordova.bat build %*
\ No newline at end of file
+%~dp0\cordova.bat build %*
diff --git a/bin/templates/cordova/clean.bat b/bin/templates/cordova/clean.bat
index b41bdc91..643c8d59 100644
--- a/bin/templates/cordova/clean.bat
+++ b/bin/templates/cordova/clean.bat
@@ -1,2 +1,18 @@
+:: 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.
@ECHO OFF
%~dp0\cordova.bat clean %*
diff --git a/bin/templates/cordova/cordova.bat b/bin/templates/cordova/cordova.bat
index 9b561993..6235fdb7 100644
--- a/bin/templates/cordova/cordova.bat
+++ b/bin/templates/cordova/cordova.bat
@@ -1,5 +1,3 @@
-@ECHO OFF
-GOTO BEGIN
:: 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
@@ -16,7 +14,7 @@ GOTO BEGIN
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
-:BEGIN
+@ECHO OFF
IF NOT DEFINED JAVA_HOME GOTO MISSING
FOR %%X in (java.exe ant.bat android.bat) do (
SET FOUND=%%~$PATH:X
diff --git a/bin/templates/cordova/lib/install-device.bat b/bin/templates/cordova/lib/install-device.bat
index 52d97759..b00e757b 100644
--- a/bin/templates/cordova/lib/install-device.bat
+++ b/bin/templates/cordova/lib/install-device.bat
@@ -1,3 +1,19 @@
+:: 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.
@ECHO OFF
SET full_path=%~dp0
IF EXIST %full_path%cordova.js (
@@ -6,4 +22,4 @@ IF EXIST %full_path%cordova.js (
ECHO.
ECHO ERROR: Could not find 'cordova.js' in cordova/lib, aborting...>&2
EXIT /B 1
-)
\ No newline at end of file
+)
diff --git a/bin/templates/cordova/lib/install-emulator.bat b/bin/templates/cordova/lib/install-emulator.bat
index d11a7be3..2b886304 100644
--- a/bin/templates/cordova/lib/install-emulator.bat
+++ b/bin/templates/cordova/lib/install-emulator.bat
@@ -1,3 +1,19 @@
+:: 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.
@ECHO OFF
SET full_path=%~dp0
IF EXIST %full_path%cordova.js (
@@ -6,4 +22,4 @@ IF EXIST %full_path%cordova.js (
ECHO.
ECHO ERROR: Could not find 'cordova.js' in cordova/lib, aborting...>&2
EXIT /B 1
-)
\ No newline at end of file
+)
diff --git a/bin/templates/cordova/lib/list-devices.bat b/bin/templates/cordova/lib/list-devices.bat
index c146f105..3840d129 100644
--- a/bin/templates/cordova/lib/list-devices.bat
+++ b/bin/templates/cordova/lib/list-devices.bat
@@ -1,3 +1,19 @@
+:: 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.
@ECHO OFF
SET full_path=%~dp0
IF EXIST %full_path%cordova.js (
@@ -6,4 +22,4 @@ IF EXIST %full_path%cordova.js (
ECHO.
ECHO ERROR: Could not find 'cordova.js' in cordova/lib, aborting...>&2
EXIT /B 1
-)
\ No newline at end of file
+)
diff --git a/bin/templates/cordova/lib/list-emulator-images.bat b/bin/templates/cordova/lib/list-emulator-images.bat
index 172520b3..e21aafe9 100644
--- a/bin/templates/cordova/lib/list-emulator-images.bat
+++ b/bin/templates/cordova/lib/list-emulator-images.bat
@@ -1,3 +1,19 @@
+:: 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.
@ECHO OFF
SET full_path=%~dp0
IF EXIST %full_path%cordova.js (
@@ -6,4 +22,4 @@ IF EXIST %full_path%cordova.js (
ECHO.
ECHO ERROR: Could not find 'cordova.js' in cordova/lib, aborting...>&2
EXIT /B 1
-)
\ No newline at end of file
+)
diff --git a/bin/templates/cordova/lib/list-started-emulators.bat b/bin/templates/cordova/lib/list-started-emulators.bat
index f1b3c5d3..eb9f3b62 100644
--- a/bin/templates/cordova/lib/list-started-emulators.bat
+++ b/bin/templates/cordova/lib/list-started-emulators.bat
@@ -1,3 +1,19 @@
+:: 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.
@ECHO OFF
SET full_path=%~dp0
IF EXIST %full_path%cordova.js (
@@ -6,4 +22,4 @@ IF EXIST %full_path%cordova.js (
ECHO.
ECHO ERROR: Could not find 'cordova.js' in cordova/lib, aborting...>&2
EXIT /B 1
-)
\ No newline at end of file
+)
diff --git a/bin/templates/cordova/lib/start-emulator.bat b/bin/templates/cordova/lib/start-emulator.bat
index 4f3fb5d8..758c854c 100644
--- a/bin/templates/cordova/lib/start-emulator.bat
+++ b/bin/templates/cordova/lib/start-emulator.bat
@@ -1,3 +1,19 @@
+:: 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.
@ECHO OFF
SET full_path=%~dp0
IF EXIST %full_path%cordova.js (
@@ -6,4 +22,4 @@ IF EXIST %full_path%cordova.js (
ECHO.
ECHO ERROR: Could not find 'cordova.js' in cordova/lib, aborting...>&2
EXIT /B 1
-)
\ No newline at end of file
+)
diff --git a/bin/templates/cordova/log.bat b/bin/templates/cordova/log.bat
index 2c492e75..c2598026 100644
--- a/bin/templates/cordova/log.bat
+++ b/bin/templates/cordova/log.bat
@@ -1,2 +1,18 @@
+:: 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.
@ECHO OFF
%~dp0\cordova.bat log %*
diff --git a/bin/templates/cordova/run.bat b/bin/templates/cordova/run.bat
index b1cab648..f191f675 100644
--- a/bin/templates/cordova/run.bat
+++ b/bin/templates/cordova/run.bat
@@ -1,2 +1,18 @@
+:: 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.
@ECHO OFF
-%~dp0\cordova.bat run %*
\ No newline at end of file
+%~dp0\cordova.bat run %*
diff --git a/bin/templates/cordova/version b/bin/templates/cordova/version
index 21147abd..5760e95a 100755
--- a/bin/templates/cordova/version
+++ b/bin/templates/cordova/version
@@ -24,7 +24,7 @@ PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
VERSION_FILE_PATH="$PROJECT_PATH/assets/www/cordova.js"
if [ -f "$VERSION_FILE_PATH" ]; then
- JSVersion=$(sed -n '2,2p' assets/www/cordova.js)
+ JSVersion=$(sed -n '2,2p' $VERSION_FILE_PATH)
echo $JSVersion | sed -e 's/\/\/ //'| cut -f 1 -d '-'
else
echo "The file \"$VERSION_FILE_PATH\" does not exist."
diff --git a/bin/update b/bin/update
index 92ceda82..20440d48 100755
--- a/bin/update
+++ b/bin/update
@@ -45,9 +45,9 @@ fi
# cleanup after exit and/or on error
function on_exit {
- if [ -f "$BUILD_PATH"/framework/assets/www/cordova-$VERSION.js ]
+ if [ -f "$BUILD_PATH"/framework/assets/www/cordova.js ]
then
- rm "$BUILD_PATH"/framework/assets/www/cordova-$VERSION.js
+ rm "$BUILD_PATH"/framework/assets/www/cordova.js
fi
if [ -f "$BUILD_PATH"/framework/cordova-$VERSION.jar ]
then
@@ -64,8 +64,6 @@ function createAppInfoJar {
function on_error {
echo "An unexpected error occurred: $previous_command exited with $?"
- echo "Deleting project..."
- [ -d "$PROJECT_PATH" ] && rm -rf "$PROJECT_PATH"
exit 1
}
@@ -122,10 +120,10 @@ fi
# copy cordova.js, cordova.jar and res/xml
if [ -d "$BUILD_PATH"/framework ]
then
- cp "$BUILD_PATH"/framework/assets/www/cordova-$VERSION.js "$PROJECT_PATH"/assets/www/cordova-$VERSION.js
+ cp "$BUILD_PATH"/framework/assets/www/cordova.js "$PROJECT_PATH"/assets/www/cordova.js
cp "$BUILD_PATH"/framework/cordova-$VERSION.jar "$PROJECT_PATH"/libs/cordova-$VERSION.jar
else
- cp "$BUILD_PATH"/cordova-$VERSION.js "$PROJECT_PATH"/assets/www/cordova-$VERSION.js
+ cp "$BUILD_PATH"/cordova.js "$PROJECT_PATH"/assets/www/cordova.js
cp "$BUILD_PATH"/cordova-$VERSION.jar "$PROJECT_PATH"/libs/cordova-$VERSION.jar
fi
diff --git a/bin/update.js b/bin/update.js
index 748d6026..8396d6fe 100644
--- a/bin/update.js
+++ b/bin/update.js
@@ -96,46 +96,6 @@ function cleanup() {
}
}
-function downloadCommonsCodec() {
- if (!fso.FileExists(ROOT + '\\framework\\libs\\commons-codec-1.7.jar')) {
- // We need the .jar
- var url = 'http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.7-bin.zip';
- var libsPath = ROOT + '\\framework\\libs';
- var savePath = libsPath + '\\commons-codec-1.7-bin.zip';
- if (!fso.FileExists(savePath)) {
- if(!fso.FolderExists(ROOT + '\\framework\\libs')) {
- fso.CreateFolder(libsPath);
- }
- // We need the zip to get the jar
- var xhr = WScript.CreateObject('MSXML2.XMLHTTP');
- xhr.open('GET', url, false);
- xhr.send();
- if (xhr.status == 200) {
- var stream = WScript.CreateObject('ADODB.Stream');
- stream.Open();
- stream.Type = 1;
- stream.Write(xhr.ResponseBody);
- stream.Position = 0;
- stream.SaveToFile(savePath);
- stream.Close();
- } else {
- WScript.Echo('Could not retrieve the commons-codec. Please download it yourself and put into the framework/libs directory. This process may fail now. Sorry.');
- }
- }
- var app = WScript.CreateObject('Shell.Application');
- var source = app.NameSpace(savePath).Items();
- var target = app.NameSpace(ROOT + '\\framework\\libs');
- target.CopyHere(source, 256);
-
- // Move the jar into libs
- fso.MoveFile(ROOT + '\\framework\\libs\\commons-codec-1.7\\commons-codec-1.7.jar', ROOT + '\\framework\\libs\\commons-codec-1.7.jar');
-
- // Clean up
- fso.DeleteFile(ROOT + '\\framework\\libs\\commons-codec-1.7-bin.zip');
- fso.DeleteFolder(ROOT + '\\framework\\libs\\commons-codec-1.7', true);
- }
-}
-
var args = WScript.Arguments, PROJECT_PATH="example",
shell=WScript.CreateObject("WScript.Shell");
@@ -161,8 +121,6 @@ if (!fso.FileExists(ROOT+'\\cordova-'+VERSION+'.jar') &&
WScript.Echo("Building jar and js files...");
// update the cordova framework project to a target that exists on this machine
exec('android.bat update project --target '+TARGET+' --path '+ROOT+'\\framework');
- // pull down commons codec if necessary
- downloadCommonsCodec();
exec('ant.bat -f \"'+ ROOT +'\\framework\\build.xml\" jar');
}
diff --git a/framework/.classpath b/framework/.classpath
index 1b06df2c..767bb465 100644
--- a/framework/.classpath
+++ b/framework/.classpath
@@ -3,7 +3,6 @@
-
diff --git a/framework/assets/www/cordova.js b/framework/assets/www/cordova.js
index f3c20a7e..aece2e6c 100644
--- a/framework/assets/www/cordova.js
+++ b/framework/assets/www/cordova.js
@@ -1,5 +1,5 @@
// Platform: android
-// 2.7.0rc1-84-gdba3744
+// 2.7.0rc1-84-g62c5786
/*
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 = '2.7.0rc1-84-gdba3744';
+var CORDOVA_JS_BUILD_LABEL = '2.7.0rc1-84-g62c5786';
// file: lib/scripts/require.js
var require,
@@ -1159,6 +1159,156 @@ module.exports = {
});
+// file: lib/common/plugin/Acceleration.js
+define("cordova/plugin/Acceleration", function(require, exports, module) {
+
+var Acceleration = function(x, y, z, timestamp) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.timestamp = timestamp || (new Date()).getTime();
+};
+
+module.exports = Acceleration;
+
+});
+
+// file: lib/common/plugin/Camera.js
+define("cordova/plugin/Camera", function(require, exports, module) {
+
+var argscheck = require('cordova/argscheck'),
+ exec = require('cordova/exec'),
+ Camera = require('cordova/plugin/CameraConstants'),
+ CameraPopoverHandle = require('cordova/plugin/CameraPopoverHandle');
+
+var cameraExport = {};
+
+// Tack on the Camera Constants to the base camera plugin.
+for (var key in Camera) {
+ cameraExport[key] = Camera[key];
+}
+
+/**
+ * Gets a picture from source defined by "options.sourceType", and returns the
+ * image as defined by the "options.destinationType" option.
+
+ * The defaults are sourceType=CAMERA and destinationType=FILE_URI.
+ *
+ * @param {Function} successCallback
+ * @param {Function} errorCallback
+ * @param {Object} options
+ */
+cameraExport.getPicture = function(successCallback, errorCallback, options) {
+ argscheck.checkArgs('fFO', 'Camera.getPicture', arguments);
+ options = options || {};
+ var getValue = argscheck.getValue;
+
+ var quality = getValue(options.quality, 50);
+ var destinationType = getValue(options.destinationType, Camera.DestinationType.FILE_URI);
+ var sourceType = getValue(options.sourceType, Camera.PictureSourceType.CAMERA);
+ var targetWidth = getValue(options.targetWidth, -1);
+ var targetHeight = getValue(options.targetHeight, -1);
+ var encodingType = getValue(options.encodingType, Camera.EncodingType.JPEG);
+ var mediaType = getValue(options.mediaType, Camera.MediaType.PICTURE);
+ var allowEdit = !!options.allowEdit;
+ var correctOrientation = !!options.correctOrientation;
+ var saveToPhotoAlbum = !!options.saveToPhotoAlbum;
+ var popoverOptions = getValue(options.popoverOptions, null);
+ var cameraDirection = getValue(options.cameraDirection, Camera.Direction.BACK);
+
+ var args = [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType,
+ mediaType, allowEdit, correctOrientation, saveToPhotoAlbum, popoverOptions, cameraDirection];
+
+ exec(successCallback, errorCallback, "Camera", "takePicture", args);
+ return new CameraPopoverHandle();
+};
+
+cameraExport.cleanup = function(successCallback, errorCallback) {
+ exec(successCallback, errorCallback, "Camera", "cleanup", []);
+};
+
+module.exports = cameraExport;
+
+});
+
+// file: lib/common/plugin/CameraConstants.js
+define("cordova/plugin/CameraConstants", function(require, exports, module) {
+
+module.exports = {
+ DestinationType:{
+ DATA_URL: 0, // Return base64 encoded string
+ FILE_URI: 1, // Return file uri (content://media/external/images/media/2 for Android)
+ NATIVE_URI: 2 // Return native uri (eg. asset-library://... for iOS)
+ },
+ EncodingType:{
+ JPEG: 0, // Return JPEG encoded image
+ PNG: 1 // Return PNG encoded image
+ },
+ MediaType:{
+ PICTURE: 0, // allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType
+ VIDEO: 1, // allow selection of video only, ONLY RETURNS URL
+ ALLMEDIA : 2 // allow selection from all media types
+ },
+ PictureSourceType:{
+ PHOTOLIBRARY : 0, // Choose image from picture library (same as SAVEDPHOTOALBUM for Android)
+ CAMERA : 1, // Take picture from camera
+ SAVEDPHOTOALBUM : 2 // Choose image from picture library (same as PHOTOLIBRARY for Android)
+ },
+ PopoverArrowDirection:{
+ ARROW_UP : 1, // matches iOS UIPopoverArrowDirection constants to specify arrow location on popover
+ ARROW_DOWN : 2,
+ ARROW_LEFT : 4,
+ ARROW_RIGHT : 8,
+ ARROW_ANY : 15
+ },
+ Direction:{
+ BACK: 0,
+ FRONT: 1
+ }
+};
+
+});
+
+// file: lib/common/plugin/CameraPopoverHandle.js
+define("cordova/plugin/CameraPopoverHandle", function(require, exports, module) {
+
+var exec = require('cordova/exec');
+
+/**
+ * A handle to an image picker popover.
+ */
+var CameraPopoverHandle = function() {
+ this.setPosition = function(popoverOptions) {
+ console.log('CameraPopoverHandle.setPosition is only supported on iOS.');
+ };
+};
+
+module.exports = CameraPopoverHandle;
+
+});
+
+// file: lib/common/plugin/CameraPopoverOptions.js
+define("cordova/plugin/CameraPopoverOptions", function(require, exports, module) {
+
+var Camera = require('cordova/plugin/CameraConstants');
+
+/**
+ * Encapsulates options for iOS Popover image picker
+ */
+var CameraPopoverOptions = function(x,y,width,height,arrowDir){
+ // information of rectangle that popover should be anchored to
+ this.x = x || 0;
+ this.y = y || 32;
+ this.width = width || 320;
+ this.height = height || 480;
+ // The direction of the popover arrow
+ this.arrowDir = arrowDir || Camera.PopoverArrowDirection.ARROW_ANY;
+};
+
+module.exports = CameraPopoverOptions;
+
+});
+
// file: lib/common/plugin/CaptureAudioOptions.js
define("cordova/plugin/CaptureAudioOptions", function(require, exports, module) {
@@ -1233,6 +1383,39 @@ module.exports = CaptureVideoOptions;
});
+// file: lib/common/plugin/CompassError.js
+define("cordova/plugin/CompassError", function(require, exports, module) {
+
+/**
+ * CompassError.
+ * An error code assigned by an implementation when an error has occurred
+ * @constructor
+ */
+var CompassError = function(err) {
+ this.code = (err !== undefined ? err : null);
+};
+
+CompassError.COMPASS_INTERNAL_ERR = 0;
+CompassError.COMPASS_NOT_SUPPORTED = 20;
+
+module.exports = CompassError;
+
+});
+
+// file: lib/common/plugin/CompassHeading.js
+define("cordova/plugin/CompassHeading", function(require, exports, module) {
+
+var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, timestamp) {
+ this.magneticHeading = magneticHeading;
+ this.trueHeading = trueHeading;
+ this.headingAccuracy = headingAccuracy;
+ this.timestamp = timestamp || new Date().getTime();
+};
+
+module.exports = CompassHeading;
+
+});
+
// file: lib/common/plugin/ConfigurationData.js
define("cordova/plugin/ConfigurationData", function(require, exports, module) {
@@ -1273,6 +1456,322 @@ module.exports = {
});
+// file: lib/common/plugin/Contact.js
+define("cordova/plugin/Contact", function(require, exports, module) {
+
+var argscheck = require('cordova/argscheck'),
+ exec = require('cordova/exec'),
+ ContactError = require('cordova/plugin/ContactError'),
+ utils = require('cordova/utils');
+
+/**
+* Converts primitives into Complex Object
+* Currently only used for Date fields
+*/
+function convertIn(contact) {
+ var value = contact.birthday;
+ try {
+ contact.birthday = new Date(parseFloat(value));
+ } catch (exception){
+ console.log("Cordova Contact convertIn error: exception creating date.");
+ }
+ return contact;
+}
+
+/**
+* Converts Complex objects into primitives
+* Only conversion at present is for Dates.
+**/
+
+function convertOut(contact) {
+ var value = contact.birthday;
+ if (value !== null) {
+ // try to make it a Date object if it is not already
+ if (!utils.isDate(value)){
+ try {
+ value = new Date(value);
+ } catch(exception){
+ value = null;
+ }
+ }
+ if (utils.isDate(value)){
+ value = value.valueOf(); // convert to milliseconds
+ }
+ contact.birthday = value;
+ }
+ return contact;
+}
+
+/**
+* Contains information about a single contact.
+* @constructor
+* @param {DOMString} id unique identifier
+* @param {DOMString} displayName
+* @param {ContactName} name
+* @param {DOMString} nickname
+* @param {Array.} phoneNumbers array of phone numbers
+* @param {Array.} emails array of email addresses
+* @param {Array.} addresses array of addresses
+* @param {Array.} ims instant messaging user ids
+* @param {Array.} organizations
+* @param {DOMString} birthday contact's birthday
+* @param {DOMString} note user notes about contact
+* @param {Array.} photos
+* @param {Array.} categories
+* @param {Array.} urls contact's web sites
+*/
+var Contact = function (id, displayName, name, nickname, phoneNumbers, emails, addresses,
+ ims, organizations, birthday, note, photos, categories, urls) {
+ this.id = id || null;
+ this.rawId = null;
+ this.displayName = displayName || null;
+ this.name = name || null; // ContactName
+ this.nickname = nickname || null;
+ this.phoneNumbers = phoneNumbers || null; // ContactField[]
+ this.emails = emails || null; // ContactField[]
+ this.addresses = addresses || null; // ContactAddress[]
+ this.ims = ims || null; // ContactField[]
+ this.organizations = organizations || null; // ContactOrganization[]
+ this.birthday = birthday || null;
+ this.note = note || null;
+ this.photos = photos || null; // ContactField[]
+ this.categories = categories || null; // ContactField[]
+ this.urls = urls || null; // ContactField[]
+};
+
+/**
+* Removes contact from device storage.
+* @param successCB success callback
+* @param errorCB error callback
+*/
+Contact.prototype.remove = function(successCB, errorCB) {
+ argscheck.checkArgs('FF', 'Contact.remove', arguments);
+ var fail = errorCB && function(code) {
+ errorCB(new ContactError(code));
+ };
+ if (this.id === null) {
+ fail(ContactError.UNKNOWN_ERROR);
+ }
+ else {
+ exec(successCB, fail, "Contacts", "remove", [this.id]);
+ }
+};
+
+/**
+* Creates a deep copy of this Contact.
+* With the contact ID set to null.
+* @return copy of this Contact
+*/
+Contact.prototype.clone = function() {
+ var clonedContact = utils.clone(this);
+ clonedContact.id = null;
+ clonedContact.rawId = null;
+
+ function nullIds(arr) {
+ if (arr) {
+ for (var i = 0; i < arr.length; ++i) {
+ arr[i].id = null;
+ }
+ }
+ }
+
+ // Loop through and clear out any id's in phones, emails, etc.
+ nullIds(clonedContact.phoneNumbers);
+ nullIds(clonedContact.emails);
+ nullIds(clonedContact.addresses);
+ nullIds(clonedContact.ims);
+ nullIds(clonedContact.organizations);
+ nullIds(clonedContact.categories);
+ nullIds(clonedContact.photos);
+ nullIds(clonedContact.urls);
+ return clonedContact;
+};
+
+/**
+* Persists contact to device storage.
+* @param successCB success callback
+* @param errorCB error callback
+*/
+Contact.prototype.save = function(successCB, errorCB) {
+ argscheck.checkArgs('FFO', 'Contact.save', arguments);
+ var fail = errorCB && function(code) {
+ errorCB(new ContactError(code));
+ };
+ var success = function(result) {
+ if (result) {
+ if (successCB) {
+ var fullContact = require('cordova/plugin/contacts').create(result);
+ successCB(convertIn(fullContact));
+ }
+ }
+ else {
+ // no Entry object returned
+ fail(ContactError.UNKNOWN_ERROR);
+ }
+ };
+ var dupContact = convertOut(utils.clone(this));
+ exec(success, fail, "Contacts", "save", [dupContact]);
+};
+
+
+module.exports = Contact;
+
+});
+
+// file: lib/common/plugin/ContactAddress.js
+define("cordova/plugin/ContactAddress", function(require, exports, module) {
+
+/**
+* Contact address.
+* @constructor
+* @param {DOMString} id unique identifier, should only be set by native code
+* @param formatted // NOTE: not a W3C standard
+* @param streetAddress
+* @param locality
+* @param region
+* @param postalCode
+* @param country
+*/
+
+var ContactAddress = function(pref, type, formatted, streetAddress, locality, region, postalCode, country) {
+ this.id = null;
+ this.pref = (typeof pref != 'undefined' ? pref : false);
+ this.type = type || null;
+ this.formatted = formatted || null;
+ this.streetAddress = streetAddress || null;
+ this.locality = locality || null;
+ this.region = region || null;
+ this.postalCode = postalCode || null;
+ this.country = country || null;
+};
+
+module.exports = ContactAddress;
+
+});
+
+// file: lib/common/plugin/ContactError.js
+define("cordova/plugin/ContactError", function(require, exports, module) {
+
+/**
+ * ContactError.
+ * An error code assigned by an implementation when an error has occurred
+ * @constructor
+ */
+var ContactError = function(err) {
+ this.code = (typeof err != 'undefined' ? err : null);
+};
+
+/**
+ * Error codes
+ */
+ContactError.UNKNOWN_ERROR = 0;
+ContactError.INVALID_ARGUMENT_ERROR = 1;
+ContactError.TIMEOUT_ERROR = 2;
+ContactError.PENDING_OPERATION_ERROR = 3;
+ContactError.IO_ERROR = 4;
+ContactError.NOT_SUPPORTED_ERROR = 5;
+ContactError.PERMISSION_DENIED_ERROR = 20;
+
+module.exports = ContactError;
+
+});
+
+// file: lib/common/plugin/ContactField.js
+define("cordova/plugin/ContactField", function(require, exports, module) {
+
+/**
+* Generic contact field.
+* @constructor
+* @param {DOMString} id unique identifier, should only be set by native code // NOTE: not a W3C standard
+* @param type
+* @param value
+* @param pref
+*/
+var ContactField = function(type, value, pref) {
+ this.id = null;
+ this.type = (type && type.toString()) || null;
+ this.value = (value && value.toString()) || null;
+ this.pref = (typeof pref != 'undefined' ? pref : false);
+};
+
+module.exports = ContactField;
+
+});
+
+// file: lib/common/plugin/ContactFindOptions.js
+define("cordova/plugin/ContactFindOptions", function(require, exports, module) {
+
+/**
+ * ContactFindOptions.
+ * @constructor
+ * @param filter used to match contacts against
+ * @param multiple boolean used to determine if more than one contact should be returned
+ */
+
+var ContactFindOptions = function(filter, multiple) {
+ this.filter = filter || '';
+ this.multiple = (typeof multiple != 'undefined' ? multiple : false);
+};
+
+module.exports = ContactFindOptions;
+
+});
+
+// file: lib/common/plugin/ContactName.js
+define("cordova/plugin/ContactName", function(require, exports, module) {
+
+/**
+* Contact name.
+* @constructor
+* @param formatted // NOTE: not part of W3C standard
+* @param familyName
+* @param givenName
+* @param middle
+* @param prefix
+* @param suffix
+*/
+var ContactName = function(formatted, familyName, givenName, middle, prefix, suffix) {
+ this.formatted = formatted || null;
+ this.familyName = familyName || null;
+ this.givenName = givenName || null;
+ this.middleName = middle || null;
+ this.honorificPrefix = prefix || null;
+ this.honorificSuffix = suffix || null;
+};
+
+module.exports = ContactName;
+
+});
+
+// file: lib/common/plugin/ContactOrganization.js
+define("cordova/plugin/ContactOrganization", function(require, exports, module) {
+
+/**
+* Contact organization.
+* @constructor
+* @param {DOMString} id unique identifier, should only be set by native code // NOTE: not a W3C standard
+* @param name
+* @param dept
+* @param title
+* @param startDate
+* @param endDate
+* @param location
+* @param desc
+*/
+
+var ContactOrganization = function(pref, type, name, dept, title) {
+ this.id = null;
+ this.pref = (typeof pref != 'undefined' ? pref : false);
+ this.type = type || null;
+ this.name = name || null;
+ this.department = dept || null;
+ this.title = title || null;
+};
+
+module.exports = ContactOrganization;
+
+});
+
// file: lib/common/plugin/Coordinates.js
define("cordova/plugin/Coordinates", function(require, exports, module) {
@@ -1897,11 +2396,7 @@ function initRead(reader, file) {
reader._error = null;
reader._readyState = FileReader.LOADING;
- if (typeof file == 'string') {
- // Deprecated in Cordova 2.4.
- console.warn('Using a string argument with FileReader.readAs functions is deprecated.');
- reader._fileName = file;
- } else if (typeof file.fullPath == 'string') {
+ if (typeof file.fullPath == 'string') {
reader._fileName = file.fullPath;
} else {
reader._fileName = '';
@@ -2791,6 +3286,85 @@ GlobalizationError.PATTERN_ERROR = 3;
module.exports = GlobalizationError;
+});
+
+// file: lib/common/plugin/InAppBrowser.js
+define("cordova/plugin/InAppBrowser", function(require, exports, module) {
+
+var exec = require('cordova/exec');
+var channel = require('cordova/channel');
+var modulemapper = require('cordova/modulemapper');
+
+function InAppBrowser() {
+ this.channels = {
+ 'loadstart': channel.create('loadstart'),
+ 'loadstop' : channel.create('loadstop'),
+ 'loaderror' : channel.create('loaderror'),
+ 'exit' : channel.create('exit')
+ };
+}
+
+InAppBrowser.prototype = {
+ _eventHandler: function (event) {
+ if (event.type in this.channels) {
+ this.channels[event.type].fire(event);
+ }
+ },
+ close: function (eventname) {
+ exec(null, null, "InAppBrowser", "close", []);
+ },
+ show: function (eventname) {
+ exec(null, null, "InAppBrowser", "show", []);
+ },
+ addEventListener: function (eventname,f) {
+ if (eventname in this.channels) {
+ this.channels[eventname].subscribe(f);
+ }
+ },
+ removeEventListener: function(eventname, f) {
+ if (eventname in this.channels) {
+ this.channels[eventname].unsubscribe(f);
+ }
+ },
+
+ executeScript: function(injectDetails, cb) {
+ if (injectDetails.code) {
+ exec(cb, null, "InAppBrowser", "injectScriptCode", [injectDetails.code, !!cb]);
+ } else if (injectDetails.file) {
+ exec(cb, null, "InAppBrowser", "injectScriptFile", [injectDetails.file, !!cb]);
+ } else {
+ throw new Error('executeScript requires exactly one of code or file to be specified');
+ }
+ },
+
+ insertCSS: function(injectDetails, cb) {
+ if (injectDetails.code) {
+ exec(cb, null, "InAppBrowser", "injectStyleCode", [injectDetails.code, !!cb]);
+ } else if (injectDetails.file) {
+ exec(cb, null, "InAppBrowser", "injectStyleFile", [injectDetails.file, !!cb]);
+ } else {
+ throw new Error('insertCSS requires exactly one of code or file to be specified');
+ }
+ }
+};
+
+module.exports = function(strUrl, strWindowName, strWindowFeatures) {
+ var iab = new InAppBrowser();
+ var cb = function(eventname) {
+ iab._eventHandler(eventname);
+ };
+
+ // Don't catch calls that write to existing frames (e.g. named iframes).
+ if (window.frames && window.frames[strWindowName]) {
+ var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open');
+ return origOpenFunc.apply(window, arguments);
+ }
+
+ exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
+ return iab;
+};
+
+
});
// file: lib/common/plugin/LocalFileSystem.js
@@ -3112,6 +3686,47 @@ module.exports = Metadata;
});
+// file: lib/common/plugin/Position.js
+define("cordova/plugin/Position", function(require, exports, module) {
+
+var Coordinates = require('cordova/plugin/Coordinates');
+
+var Position = function(coords, timestamp) {
+ if (coords) {
+ this.coords = new Coordinates(coords.latitude, coords.longitude, coords.altitude, coords.accuracy, coords.heading, coords.velocity, coords.altitudeAccuracy);
+ } else {
+ this.coords = new Coordinates();
+ }
+ this.timestamp = (timestamp !== undefined) ? timestamp : new Date();
+};
+
+module.exports = Position;
+
+});
+
+// file: lib/common/plugin/PositionError.js
+define("cordova/plugin/PositionError", function(require, exports, module) {
+
+/**
+ * Position error object
+ *
+ * @constructor
+ * @param code
+ * @param message
+ */
+var PositionError = function(code, message) {
+ this.code = code || null;
+ this.message = message || '';
+};
+
+PositionError.PERMISSION_DENIED = 1;
+PositionError.POSITION_UNAVAILABLE = 2;
+PositionError.TIMEOUT = 3;
+
+module.exports = PositionError;
+
+});
+
// file: lib/common/plugin/ProgressEvent.js
define("cordova/plugin/ProgressEvent", function(require, exports, module) {
@@ -3164,6 +3779,172 @@ module.exports = ProgressEvent;
});
+// file: lib/common/plugin/accelerometer.js
+define("cordova/plugin/accelerometer", function(require, exports, module) {
+
+/**
+ * This class provides access to device accelerometer data.
+ * @constructor
+ */
+var argscheck = require('cordova/argscheck'),
+ utils = require("cordova/utils"),
+ exec = require("cordova/exec"),
+ Acceleration = require('cordova/plugin/Acceleration');
+
+// Is the accel sensor running?
+var running = false;
+
+// Keeps reference to watchAcceleration calls.
+var timers = {};
+
+// Array of listeners; used to keep track of when we should call start and stop.
+var listeners = [];
+
+// Last returned acceleration object from native
+var accel = null;
+
+// Tells native to start.
+function start() {
+ exec(function(a) {
+ var tempListeners = listeners.slice(0);
+ accel = new Acceleration(a.x, a.y, a.z, a.timestamp);
+ for (var i = 0, l = tempListeners.length; i < l; i++) {
+ tempListeners[i].win(accel);
+ }
+ }, function(e) {
+ var tempListeners = listeners.slice(0);
+ for (var i = 0, l = tempListeners.length; i < l; i++) {
+ tempListeners[i].fail(e);
+ }
+ }, "Accelerometer", "start", []);
+ running = true;
+}
+
+// Tells native to stop.
+function stop() {
+ exec(null, null, "Accelerometer", "stop", []);
+ running = false;
+}
+
+// Adds a callback pair to the listeners array
+function createCallbackPair(win, fail) {
+ return {win:win, fail:fail};
+}
+
+// Removes a win/fail listener pair from the listeners array
+function removeListeners(l) {
+ var idx = listeners.indexOf(l);
+ if (idx > -1) {
+ listeners.splice(idx, 1);
+ if (listeners.length === 0) {
+ stop();
+ }
+ }
+}
+
+var accelerometer = {
+ /**
+ * Asynchronously acquires the current acceleration.
+ *
+ * @param {Function} successCallback The function to call when the acceleration data is available
+ * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL)
+ * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
+ */
+ getCurrentAcceleration: function(successCallback, errorCallback, options) {
+ argscheck.checkArgs('fFO', 'accelerometer.getCurrentAcceleration', arguments);
+
+ var p;
+ var win = function(a) {
+ removeListeners(p);
+ successCallback(a);
+ };
+ var fail = function(e) {
+ removeListeners(p);
+ errorCallback && errorCallback(e);
+ };
+
+ p = createCallbackPair(win, fail);
+ listeners.push(p);
+
+ if (!running) {
+ start();
+ }
+ },
+
+ /**
+ * Asynchronously acquires the acceleration repeatedly at a given interval.
+ *
+ * @param {Function} successCallback The function to call each time the acceleration data is available
+ * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL)
+ * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
+ * @return String The watch id that must be passed to #clearWatch to stop watching.
+ */
+ watchAcceleration: function(successCallback, errorCallback, options) {
+ argscheck.checkArgs('fFO', 'accelerometer.watchAcceleration', arguments);
+ // Default interval (10 sec)
+ var frequency = (options && options.frequency && typeof options.frequency == 'number') ? options.frequency : 10000;
+
+ // Keep reference to watch id, and report accel readings as often as defined in frequency
+ var id = utils.createUUID();
+
+ var p = createCallbackPair(function(){}, function(e) {
+ removeListeners(p);
+ errorCallback && errorCallback(e);
+ });
+ listeners.push(p);
+
+ timers[id] = {
+ timer:window.setInterval(function() {
+ if (accel) {
+ successCallback(accel);
+ }
+ }, frequency),
+ listeners:p
+ };
+
+ if (running) {
+ // If we're already running then immediately invoke the success callback
+ // but only if we have retrieved a value, sample code does not check for null ...
+ if (accel) {
+ successCallback(accel);
+ }
+ } else {
+ start();
+ }
+
+ return id;
+ },
+
+ /**
+ * Clears the specified accelerometer watch.
+ *
+ * @param {String} id The id of the watch returned from #watchAcceleration.
+ */
+ clearWatch: function(id) {
+ // Stop javascript timer & remove from timer list
+ if (id && timers[id]) {
+ window.clearInterval(timers[id].timer);
+ removeListeners(timers[id].listeners);
+ delete timers[id];
+ }
+ }
+};
+
+module.exports = accelerometer;
+
+});
+
+// file: lib/common/plugin/accelerometer/symbols.js
+define("cordova/plugin/accelerometer/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.defaults('cordova/plugin/Acceleration', 'Acceleration');
+modulemapper.defaults('cordova/plugin/accelerometer', 'navigator.accelerometer');
+
+});
+
// file: lib/android/plugin/android/app.js
define("cordova/plugin/android/app", function(require, exports, module) {
@@ -3289,6 +4070,10 @@ module.exports = {
// file: lib/android/plugin/android/nativeapiprovider.js
define("cordova/plugin/android/nativeapiprovider", function(require, exports, module) {
+/**
+ * Exports the ExposedJsApi.java object if available, otherwise exports the PromptBasedNativeApi.
+ */
+
var nativeApi = this._cordovaNative || require('cordova/plugin/android/promptbasednativeapi');
var currentApi = nativeApi;
@@ -3305,9 +4090,73 @@ module.exports = {
});
+// file: lib/android/plugin/android/notification.js
+define("cordova/plugin/android/notification", function(require, exports, module) {
+
+var exec = require('cordova/exec');
+
+/**
+ * Provides Android enhanced notification API.
+ */
+module.exports = {
+ activityStart : function(title, message) {
+ // If title and message not specified then mimic Android behavior of
+ // using default strings.
+ if (typeof title === "undefined" && typeof message == "undefined") {
+ title = "Busy";
+ message = 'Please wait...';
+ }
+
+ exec(null, null, 'Notification', 'activityStart', [ title, message ]);
+ },
+
+ /**
+ * Close an activity dialog
+ */
+ activityStop : function() {
+ exec(null, null, 'Notification', 'activityStop', []);
+ },
+
+ /**
+ * Display a progress dialog with progress bar that goes from 0 to 100.
+ *
+ * @param {String}
+ * title Title of the progress dialog.
+ * @param {String}
+ * message Message to display in the dialog.
+ */
+ progressStart : function(title, message) {
+ exec(null, null, 'Notification', 'progressStart', [ title, message ]);
+ },
+
+ /**
+ * Close the progress dialog.
+ */
+ progressStop : function() {
+ exec(null, null, 'Notification', 'progressStop', []);
+ },
+
+ /**
+ * Set the progress dialog value.
+ *
+ * @param {Number}
+ * value 0-100
+ */
+ progressValue : function(value) {
+ exec(null, null, 'Notification', 'progressValue', [ value ]);
+ }
+};
+
+});
+
// file: lib/android/plugin/android/promptbasednativeapi.js
define("cordova/plugin/android/promptbasednativeapi", function(require, exports, module) {
+/**
+ * Implements the API of ExposedJsApi.java, but uses prompt() to communicate.
+ * This is used only on the 2.3 simulator, where addJavascriptInterface() is broken.
+ */
+
module.exports = {
exec: function(service, action, callbackId, argsJson) {
return prompt(argsJson, 'gap:'+JSON.stringify([service, action, callbackId]));
@@ -3660,6 +4509,112 @@ var modulemapper = require('cordova/modulemapper');
modulemapper.clobbers('cordova/plugin/android/storage/openDatabase', 'openDatabase');
+});
+
+// file: lib/common/plugin/battery.js
+define("cordova/plugin/battery", function(require, exports, module) {
+
+/**
+ * This class contains information about the current battery status.
+ * @constructor
+ */
+var cordova = require('cordova'),
+ exec = require('cordova/exec');
+
+function handlers() {
+ return battery.channels.batterystatus.numHandlers +
+ battery.channels.batterylow.numHandlers +
+ battery.channels.batterycritical.numHandlers;
+}
+
+var Battery = function() {
+ this._level = null;
+ this._isPlugged = null;
+ // Create new event handlers on the window (returns a channel instance)
+ this.channels = {
+ batterystatus:cordova.addWindowEventHandler("batterystatus"),
+ batterylow:cordova.addWindowEventHandler("batterylow"),
+ batterycritical:cordova.addWindowEventHandler("batterycritical")
+ };
+ for (var key in this.channels) {
+ this.channels[key].onHasSubscribersChange = Battery.onHasSubscribersChange;
+ }
+};
+/**
+ * Event handlers for when callbacks get registered for the battery.
+ * Keep track of how many handlers we have so we can start and stop the native battery listener
+ * appropriately (and hopefully save on battery life!).
+ */
+Battery.onHasSubscribersChange = function() {
+ // If we just registered the first handler, make sure native listener is started.
+ if (this.numHandlers === 1 && handlers() === 1) {
+ exec(battery._status, battery._error, "Battery", "start", []);
+ } else if (handlers() === 0) {
+ exec(null, null, "Battery", "stop", []);
+ }
+};
+
+/**
+ * Callback for battery status
+ *
+ * @param {Object} info keys: level, isPlugged
+ */
+Battery.prototype._status = function(info) {
+ if (info) {
+ var me = battery;
+ var level = info.level;
+ if (me._level !== level || me._isPlugged !== info.isPlugged) {
+ // Fire batterystatus event
+ cordova.fireWindowEvent("batterystatus", info);
+
+ // Fire low battery event
+ if (level === 20 || level === 5) {
+ if (level === 20) {
+ cordova.fireWindowEvent("batterylow", info);
+ }
+ else {
+ cordova.fireWindowEvent("batterycritical", info);
+ }
+ }
+ }
+ me._level = level;
+ me._isPlugged = info.isPlugged;
+ }
+};
+
+/**
+ * Error callback for battery start
+ */
+Battery.prototype._error = function(e) {
+ console.log("Error initializing Battery: " + e);
+};
+
+var battery = new Battery();
+
+module.exports = battery;
+
+});
+
+// file: lib/common/plugin/battery/symbols.js
+define("cordova/plugin/battery/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.defaults('cordova/plugin/battery', 'navigator.battery');
+
+});
+
+// file: lib/common/plugin/camera/symbols.js
+define("cordova/plugin/camera/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.defaults('cordova/plugin/Camera', 'navigator.camera');
+modulemapper.defaults('cordova/plugin/CameraConstants', 'Camera');
+modulemapper.defaults('cordova/plugin/CameraPopoverOptions', 'CameraPopoverOptions');
+
});
// file: lib/common/plugin/capture.js
@@ -3756,6 +4711,105 @@ modulemapper.clobbers('cordova/plugin/capture', 'navigator.device.capture');
});
+// file: lib/common/plugin/compass.js
+define("cordova/plugin/compass", function(require, exports, module) {
+
+var argscheck = require('cordova/argscheck'),
+ exec = require('cordova/exec'),
+ utils = require('cordova/utils'),
+ CompassHeading = require('cordova/plugin/CompassHeading'),
+ CompassError = require('cordova/plugin/CompassError'),
+ timers = {},
+ compass = {
+ /**
+ * Asynchronously acquires the current heading.
+ * @param {Function} successCallback The function to call when the heading
+ * data is available
+ * @param {Function} errorCallback The function to call when there is an error
+ * getting the heading data.
+ * @param {CompassOptions} options The options for getting the heading data (not used).
+ */
+ getCurrentHeading:function(successCallback, errorCallback, options) {
+ argscheck.checkArgs('fFO', 'compass.getCurrentHeading', arguments);
+
+ var win = function(result) {
+ var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp);
+ successCallback(ch);
+ };
+ var fail = errorCallback && function(code) {
+ var ce = new CompassError(code);
+ errorCallback(ce);
+ };
+
+ // Get heading
+ exec(win, fail, "Compass", "getHeading", [options]);
+ },
+
+ /**
+ * Asynchronously acquires the heading repeatedly at a given interval.
+ * @param {Function} successCallback The function to call each time the heading
+ * data is available
+ * @param {Function} errorCallback The function to call when there is an error
+ * getting the heading data.
+ * @param {HeadingOptions} options The options for getting the heading data
+ * such as timeout and the frequency of the watch. For iOS, filter parameter
+ * specifies to watch via a distance filter rather than time.
+ */
+ watchHeading:function(successCallback, errorCallback, options) {
+ argscheck.checkArgs('fFO', 'compass.watchHeading', arguments);
+ // Default interval (100 msec)
+ var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
+ var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0;
+
+ var id = utils.createUUID();
+ if (filter > 0) {
+ // is an iOS request for watch by filter, no timer needed
+ timers[id] = "iOS";
+ compass.getCurrentHeading(successCallback, errorCallback, options);
+ } else {
+ // Start watch timer to get headings
+ timers[id] = window.setInterval(function() {
+ compass.getCurrentHeading(successCallback, errorCallback);
+ }, frequency);
+ }
+
+ return id;
+ },
+
+ /**
+ * Clears the specified heading watch.
+ * @param {String} watchId The ID of the watch returned from #watchHeading.
+ */
+ clearWatch:function(id) {
+ // Stop javascript timer & remove from timer list
+ if (id && timers[id]) {
+ if (timers[id] != "iOS") {
+ clearInterval(timers[id]);
+ } else {
+ // is iOS watch by filter so call into device to stop
+ exec(null, null, "Compass", "stopHeading", []);
+ }
+ delete timers[id];
+ }
+ }
+ };
+
+module.exports = compass;
+
+});
+
+// file: lib/common/plugin/compass/symbols.js
+define("cordova/plugin/compass/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/CompassHeading', 'CompassHeading');
+modulemapper.clobbers('cordova/plugin/CompassError', 'CompassError');
+modulemapper.clobbers('cordova/plugin/compass', 'navigator.compass');
+
+});
+
// file: lib/common/plugin/console-via-logger.js
define("cordova/plugin/console-via-logger", function(require, exports, module) {
@@ -3928,6 +4982,84 @@ for (var key in console) {
});
+// file: lib/common/plugin/contacts.js
+define("cordova/plugin/contacts", function(require, exports, module) {
+
+var argscheck = require('cordova/argscheck'),
+ exec = require('cordova/exec'),
+ ContactError = require('cordova/plugin/ContactError'),
+ utils = require('cordova/utils'),
+ Contact = require('cordova/plugin/Contact');
+
+/**
+* Represents a group of Contacts.
+* @constructor
+*/
+var contacts = {
+ /**
+ * Returns an array of Contacts matching the search criteria.
+ * @param fields that should be searched
+ * @param successCB success callback
+ * @param errorCB error callback
+ * @param {ContactFindOptions} options that can be applied to contact searching
+ * @return array of Contacts matching search criteria
+ */
+ find:function(fields, successCB, errorCB, options) {
+ argscheck.checkArgs('afFO', 'contacts.find', arguments);
+ if (!fields.length) {
+ errorCB && errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
+ } else {
+ var win = function(result) {
+ var cs = [];
+ for (var i = 0, l = result.length; i < l; i++) {
+ cs.push(contacts.create(result[i]));
+ }
+ successCB(cs);
+ };
+ exec(win, errorCB, "Contacts", "search", [fields, options]);
+ }
+ },
+
+ /**
+ * This function creates a new contact, but it does not persist the contact
+ * to device storage. To persist the contact to device storage, invoke
+ * contact.save().
+ * @param properties an object whose properties will be examined to create a new Contact
+ * @returns new Contact object
+ */
+ create:function(properties) {
+ argscheck.checkArgs('O', 'contacts.create', arguments);
+ var contact = new Contact();
+ for (var i in properties) {
+ if (typeof contact[i] !== 'undefined' && properties.hasOwnProperty(i)) {
+ contact[i] = properties[i];
+ }
+ }
+ return contact;
+ }
+};
+
+module.exports = contacts;
+
+});
+
+// file: lib/common/plugin/contacts/symbols.js
+define("cordova/plugin/contacts/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/contacts', 'navigator.contacts');
+modulemapper.clobbers('cordova/plugin/Contact', 'Contact');
+modulemapper.clobbers('cordova/plugin/ContactAddress', 'ContactAddress');
+modulemapper.clobbers('cordova/plugin/ContactError', 'ContactError');
+modulemapper.clobbers('cordova/plugin/ContactField', 'ContactField');
+modulemapper.clobbers('cordova/plugin/ContactFindOptions', 'ContactFindOptions');
+modulemapper.clobbers('cordova/plugin/ContactName', 'ContactName');
+modulemapper.clobbers('cordova/plugin/ContactOrganization', 'ContactOrganization');
+
+});
+
// file: lib/common/plugin/device.js
define("cordova/plugin/device", function(require, exports, module) {
@@ -3948,7 +5080,6 @@ function Device() {
this.available = false;
this.platform = null;
this.version = null;
- this.name = null;
this.uuid = null;
this.cordova = null;
this.model = null;
@@ -3964,7 +5095,6 @@ function Device() {
me.available = true;
me.platform = info.platform;
me.version = info.version;
- me.name = info.name;
me.uuid = info.uuid;
me.cordova = buildLabel;
me.model = info.model;
@@ -4087,6 +5217,215 @@ modulemapper.clobbers('cordova/plugin/FileTransferError', 'FileTransferError');
});
+// file: lib/common/plugin/geolocation.js
+define("cordova/plugin/geolocation", function(require, exports, module) {
+
+var argscheck = require('cordova/argscheck'),
+ utils = require('cordova/utils'),
+ exec = require('cordova/exec'),
+ PositionError = require('cordova/plugin/PositionError'),
+ Position = require('cordova/plugin/Position');
+
+var timers = {}; // list of timers in use
+
+// Returns default params, overrides if provided with values
+function parseParameters(options) {
+ var opt = {
+ maximumAge: 0,
+ enableHighAccuracy: false,
+ timeout: Infinity
+ };
+
+ if (options) {
+ if (options.maximumAge !== undefined && !isNaN(options.maximumAge) && options.maximumAge > 0) {
+ opt.maximumAge = options.maximumAge;
+ }
+ if (options.enableHighAccuracy !== undefined) {
+ opt.enableHighAccuracy = options.enableHighAccuracy;
+ }
+ if (options.timeout !== undefined && !isNaN(options.timeout)) {
+ if (options.timeout < 0) {
+ opt.timeout = 0;
+ } else {
+ opt.timeout = options.timeout;
+ }
+ }
+ }
+
+ return opt;
+}
+
+// Returns a timeout failure, closed over a specified timeout value and error callback.
+function createTimeout(errorCallback, timeout) {
+ var t = setTimeout(function() {
+ clearTimeout(t);
+ t = null;
+ errorCallback({
+ code:PositionError.TIMEOUT,
+ message:"Position retrieval timed out."
+ });
+ }, timeout);
+ return t;
+}
+
+var geolocation = {
+ lastPosition:null, // reference to last known (cached) position returned
+ /**
+ * Asynchronously acquires the current position.
+ *
+ * @param {Function} successCallback The function to call when the position data is available
+ * @param {Function} errorCallback The function to call when there is an error getting the heading position. (OPTIONAL)
+ * @param {PositionOptions} options The options for getting the position data. (OPTIONAL)
+ */
+ getCurrentPosition:function(successCallback, errorCallback, options) {
+ argscheck.checkArgs('fFO', 'geolocation.getCurrentPosition', arguments);
+ options = parseParameters(options);
+
+ // Timer var that will fire an error callback if no position is retrieved from native
+ // before the "timeout" param provided expires
+ var timeoutTimer = {timer:null};
+
+ var win = function(p) {
+ clearTimeout(timeoutTimer.timer);
+ if (!(timeoutTimer.timer)) {
+ // Timeout already happened, or native fired error callback for
+ // this geo request.
+ // Don't continue with success callback.
+ return;
+ }
+ var pos = new Position(
+ {
+ latitude:p.latitude,
+ longitude:p.longitude,
+ altitude:p.altitude,
+ accuracy:p.accuracy,
+ heading:p.heading,
+ velocity:p.velocity,
+ altitudeAccuracy:p.altitudeAccuracy
+ },
+ (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp)))
+ );
+ geolocation.lastPosition = pos;
+ successCallback(pos);
+ };
+ var fail = function(e) {
+ clearTimeout(timeoutTimer.timer);
+ timeoutTimer.timer = null;
+ var err = new PositionError(e.code, e.message);
+ if (errorCallback) {
+ errorCallback(err);
+ }
+ };
+
+ // Check our cached position, if its timestamp difference with current time is less than the maximumAge, then just
+ // fire the success callback with the cached position.
+ if (geolocation.lastPosition && options.maximumAge && (((new Date()).getTime() - geolocation.lastPosition.timestamp.getTime()) <= options.maximumAge)) {
+ successCallback(geolocation.lastPosition);
+ // If the cached position check failed and the timeout was set to 0, error out with a TIMEOUT error object.
+ } else if (options.timeout === 0) {
+ fail({
+ code:PositionError.TIMEOUT,
+ message:"timeout value in PositionOptions set to 0 and no cached Position object available, or cached Position object's age exceeds provided PositionOptions' maximumAge parameter."
+ });
+ // Otherwise we have to call into native to retrieve a position.
+ } else {
+ if (options.timeout !== Infinity) {
+ // If the timeout value was not set to Infinity (default), then
+ // set up a timeout function that will fire the error callback
+ // if no successful position was retrieved before timeout expired.
+ timeoutTimer.timer = createTimeout(fail, options.timeout);
+ } else {
+ // This is here so the check in the win function doesn't mess stuff up
+ // may seem weird but this guarantees timeoutTimer is
+ // always truthy before we call into native
+ timeoutTimer.timer = true;
+ }
+ exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.maximumAge]);
+ }
+ return timeoutTimer;
+ },
+ /**
+ * Asynchronously watches the geolocation for changes to geolocation. When a change occurs,
+ * the successCallback is called with the new location.
+ *
+ * @param {Function} successCallback The function to call each time the location data is available
+ * @param {Function} errorCallback The function to call when there is an error getting the location data. (OPTIONAL)
+ * @param {PositionOptions} options The options for getting the location data such as frequency. (OPTIONAL)
+ * @return String The watch id that must be passed to #clearWatch to stop watching.
+ */
+ watchPosition:function(successCallback, errorCallback, options) {
+ argscheck.checkArgs('fFO', 'geolocation.getCurrentPosition', arguments);
+ options = parseParameters(options);
+
+ var id = utils.createUUID();
+
+ // Tell device to get a position ASAP, and also retrieve a reference to the timeout timer generated in getCurrentPosition
+ timers[id] = geolocation.getCurrentPosition(successCallback, errorCallback, options);
+
+ var fail = function(e) {
+ clearTimeout(timers[id].timer);
+ var err = new PositionError(e.code, e.message);
+ if (errorCallback) {
+ errorCallback(err);
+ }
+ };
+
+ var win = function(p) {
+ clearTimeout(timers[id].timer);
+ if (options.timeout !== Infinity) {
+ timers[id].timer = createTimeout(fail, options.timeout);
+ }
+ var pos = new Position(
+ {
+ latitude:p.latitude,
+ longitude:p.longitude,
+ altitude:p.altitude,
+ accuracy:p.accuracy,
+ heading:p.heading,
+ velocity:p.velocity,
+ altitudeAccuracy:p.altitudeAccuracy
+ },
+ (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp)))
+ );
+ geolocation.lastPosition = pos;
+ successCallback(pos);
+ };
+
+ exec(win, fail, "Geolocation", "addWatch", [id, options.enableHighAccuracy]);
+
+ return id;
+ },
+ /**
+ * Clears the specified heading watch.
+ *
+ * @param {String} id The ID of the watch returned from #watchPosition
+ */
+ clearWatch:function(id) {
+ if (id && timers[id] !== undefined) {
+ clearTimeout(timers[id].timer);
+ timers[id].timer = false;
+ exec(null, null, "Geolocation", "clearWatch", [id]);
+ }
+ }
+};
+
+module.exports = geolocation;
+
+});
+
+// file: lib/common/plugin/geolocation/symbols.js
+define("cordova/plugin/geolocation/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.defaults('cordova/plugin/geolocation', 'navigator.geolocation');
+modulemapper.clobbers('cordova/plugin/PositionError', 'PositionError');
+modulemapper.clobbers('cordova/plugin/Position', 'Position');
+modulemapper.clobbers('cordova/plugin/Coordinates', 'Coordinates');
+
+});
+
// file: lib/common/plugin/globalization.js
define("cordova/plugin/globalization", function(require, exports, module) {
@@ -4474,6 +5813,16 @@ modulemapper.clobbers('cordova/plugin/GlobalizationError', 'GlobalizationError')
});
+// file: lib/android/plugin/inappbrowser/symbols.js
+define("cordova/plugin/inappbrowser/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/InAppBrowser', 'open');
+
+});
+
// file: lib/common/plugin/logger.js
define("cordova/plugin/logger", function(require, exports, module) {
@@ -4909,6 +6258,120 @@ modulemapper.defaults('cordova/plugin/Connection', 'Connection');
});
+// file: lib/common/plugin/notification.js
+define("cordova/plugin/notification", function(require, exports, module) {
+
+var exec = require('cordova/exec');
+var platform = require('cordova/platform');
+
+/**
+ * Provides access to notifications on the device.
+ */
+
+module.exports = {
+
+ /**
+ * Open a native alert dialog, with a customizable title and button text.
+ *
+ * @param {String} message Message to print in the body of the alert
+ * @param {Function} completeCallback The callback that is called when user clicks on a button.
+ * @param {String} title Title of the alert dialog (default: Alert)
+ * @param {String} buttonLabel Label of the close button (default: OK)
+ */
+ alert: function(message, completeCallback, title, buttonLabel) {
+ var _title = (title || "Alert");
+ var _buttonLabel = (buttonLabel || "OK");
+ exec(completeCallback, null, "Notification", "alert", [message, _title, _buttonLabel]);
+ },
+
+ /**
+ * Open a native confirm dialog, with a customizable title and button text.
+ * The result that the user selects is returned to the result callback.
+ *
+ * @param {String} message Message to print in the body of the alert
+ * @param {Function} resultCallback The callback that is called when user clicks on a button.
+ * @param {String} title Title of the alert dialog (default: Confirm)
+ * @param {Array} buttonLabels Array of the labels of the buttons (default: ['OK', 'Cancel'])
+ */
+ confirm: function(message, resultCallback, title, buttonLabels) {
+ var _title = (title || "Confirm");
+ var _buttonLabels = (buttonLabels || ["OK", "Cancel"]);
+
+ // Strings are deprecated!
+ if (typeof _buttonLabels === 'string') {
+ console.log("Notification.confirm(string, function, string, string) is deprecated. Use Notification.confirm(string, function, string, array).");
+ }
+
+ // Some platforms take an array of button label names.
+ // Other platforms take a comma separated list.
+ // For compatibility, we convert to the desired type based on the platform.
+ if (platform.id == "android" || platform.id == "ios" || platform.id == "windowsphone" || platform.id == "blackberry10") {
+ if (typeof _buttonLabels === 'string') {
+ var buttonLabelString = _buttonLabels;
+ _buttonLabels = _buttonLabels.split(","); // not crazy about changing the var type here
+ }
+ } else {
+ if (Array.isArray(_buttonLabels)) {
+ var buttonLabelArray = _buttonLabels;
+ _buttonLabels = buttonLabelArray.toString();
+ }
+ }
+ exec(resultCallback, null, "Notification", "confirm", [message, _title, _buttonLabels]);
+ },
+
+ /**
+ * Open a native prompt dialog, with a customizable title and button text.
+ * The following results are returned to the result callback:
+ * buttonIndex Index number of the button selected.
+ * input1 The text entered in the prompt dialog box.
+ *
+ * @param {String} message Dialog message to display (default: "Prompt message")
+ * @param {Function} resultCallback The callback that is called when user clicks on a button.
+ * @param {String} title Title of the dialog (default: "Prompt")
+ * @param {Array} buttonLabels Array of strings for the button labels (default: ["OK","Cancel"])
+ * @param {String} defaultText Textbox input value (default: "Default text")
+ */
+ prompt: function(message, resultCallback, title, buttonLabels, defaultText) {
+ var _message = (message || "Prompt message");
+ var _title = (title || "Prompt");
+ var _buttonLabels = (buttonLabels || ["OK","Cancel"]);
+ var _defaultText = (defaultText || "Default text");
+ exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels, _defaultText]);
+ },
+
+ /**
+ * Causes the device to vibrate.
+ *
+ * @param {Integer} mills The number of milliseconds to vibrate for.
+ */
+ vibrate: function(mills) {
+ exec(null, null, "Notification", "vibrate", [mills]);
+ },
+
+ /**
+ * Causes the device to beep.
+ * On Android, the default notification ringtone is played "count" times.
+ *
+ * @param {Integer} count The number of beeps.
+ */
+ beep: function(count) {
+ exec(null, null, "Notification", "beep", [count]);
+ }
+};
+
+});
+
+// file: lib/android/plugin/notification/symbols.js
+define("cordova/plugin/notification/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/notification', 'navigator.notification');
+modulemapper.merges('cordova/plugin/android/notification', 'navigator.notification');
+
+});
+
// file: lib/common/plugin/requestFileSystem.js
define("cordova/plugin/requestFileSystem", function(require, exports, module) {
@@ -5004,6 +6467,34 @@ module.exports = function(uri, successCallback, errorCallback) {
});
+// file: lib/common/plugin/splashscreen.js
+define("cordova/plugin/splashscreen", function(require, exports, module) {
+
+var exec = require('cordova/exec');
+
+var splashscreen = {
+ show:function() {
+ exec(null, null, "SplashScreen", "show", []);
+ },
+ hide:function() {
+ exec(null, null, "SplashScreen", "hide", []);
+ }
+};
+
+module.exports = splashscreen;
+
+});
+
+// file: lib/common/plugin/splashscreen/symbols.js
+define("cordova/plugin/splashscreen/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper');
+
+modulemapper.clobbers('cordova/plugin/splashscreen', 'navigator.splashscreen');
+
+});
+
// file: lib/common/symbols.js
define("cordova/symbols", function(require, exports, module) {
@@ -5191,6 +6682,11 @@ window.cordova = require('cordova');
// file: lib/scripts/bootstrap.js
(function (context) {
+ if (context._cordovaJsLoaded) {
+ throw new Error('cordova.js included multiple times.');
+ }
+ context._cordovaJsLoaded = true;
+
var channel = require('cordova/channel');
var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
diff --git a/framework/build.xml b/framework/build.xml
index 989dbb2f..46242aa1 100644
--- a/framework/build.xml
+++ b/framework/build.xml
@@ -31,22 +31,6 @@
-
-
-
-
-
-
-
-
-
-
-
* Log level: ERROR, WARN, INFO, DEBUG, VERBOSE (default=ERROR)
*
@@ -138,7 +134,7 @@ import android.widget.LinearLayout;
*
*/
public class CordovaActivity extends Activity implements CordovaInterface {
- public static String TAG = "DroidGap";
+ public static String TAG = "CordovaActivity";
// The webview for our app
protected CordovaWebView appView;
@@ -263,7 +259,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
@Override
public void onCreate(Bundle savedInstanceState) {
Config.init(this);
- LOG.d(TAG, "DroidGap.onCreate()");
+ LOG.d(TAG, "CordovaActivity.onCreate()");
super.onCreate(savedInstanceState);
if(savedInstanceState != null)
@@ -336,7 +332,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
*/
@SuppressLint("NewApi")
public void init(CordovaWebView webView, CordovaWebViewClient webViewClient, CordovaChromeClient webChromeClient) {
- LOG.d(TAG, "DroidGap.init()");
+ LOG.d(TAG, "CordovaActivity.init()");
// Set up web container
this.appView = webView;
@@ -599,7 +595,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
* @param value
*/
public void setBooleanProperty(String name, boolean value) {
- Log.d(TAG, "Setting boolean properties in DroidGap will be deprecated in 3.0 on July 2013, please use config.xml");
+ Log.d(TAG, "Setting boolean properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml");
this.getIntent().putExtra(name, value);
}
@@ -610,7 +606,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
* @param value
*/
public void setIntegerProperty(String name, int value) {
- Log.d(TAG, "Setting integer properties in DroidGap will be deprecated in 3.1 on August 2013, please use config.xml");
+ Log.d(TAG, "Setting integer properties in CordovaActivity will be deprecated in 3.1 on August 2013, please use config.xml");
this.getIntent().putExtra(name, value);
}
@@ -621,7 +617,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
* @param value
*/
public void setStringProperty(String name, String value) {
- Log.d(TAG, "Setting string properties in DroidGap will be deprecated in 3.0 on July 2013, please use config.xml");
+ Log.d(TAG, "Setting string properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml");
this.getIntent().putExtra(name, value);
}
@@ -632,7 +628,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
* @param value
*/
public void setDoubleProperty(String name, double value) {
- Log.d(TAG, "Setting double properties in DroidGap will be deprecated in 3.0 on July 2013, please use config.xml");
+ Log.d(TAG, "Setting double properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml");
this.getIntent().putExtra(name, value);
}
@@ -716,7 +712,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
* The final call you receive before your activity is destroyed.
*/
public void onDestroy() {
- LOG.d(TAG, "onDestroy()");
+ LOG.d(TAG, "CordovaActivity.onDestroy()");
super.onDestroy();
// hide the splash screen to avoid leaking a window
@@ -856,18 +852,13 @@ public class CordovaActivity extends Activity implements CordovaInterface {
mUploadMessage = null;
}
CordovaPlugin callback = this.activityResultCallback;
- if(callback == null)
- {
- if(initCallbackClass != null)
- {
- this.activityResultCallback = appView.pluginManager.getPlugin(initCallbackClass);
- callback = activityResultCallback;
- LOG.d(TAG, "We have a callback to send this result to");
- callback.onActivityResult(requestCode, resultCode, intent);
- }
+ if(callback == null && initCallbackClass != null) {
+ // The application was restarted, but had defined an initial callback
+ // before being shut down.
+ this.activityResultCallback = appView.pluginManager.getPlugin(initCallbackClass);
+ callback = this.activityResultCallback;
}
- else
- {
+ if(callback != null) {
LOG.d(TAG, "We have a callback to send this result to");
callback.onActivityResult(requestCode, resultCode, intent);
}
@@ -961,7 +952,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
}
/*
- * Hook in DroidGap for menu plugins
+ * Hook in Cordova for menu plugins
*
*/
@Override
@@ -1000,7 +991,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
* @param url The url to load.
* @param openExternal Load url in browser instead of Cordova webview.
* @param clearHistory Clear the history stack, so new page becomes top of history
- * @param params DroidGap parameters for new app
+ * @param params Parameters for new app
*/
public void showWebPage(String url, boolean openExternal, boolean clearHistory, HashMap params) {
if (this.appView != null) {
diff --git a/framework/src/org/apache/cordova/CordovaChromeClient.java b/framework/src/org/apache/cordova/CordovaChromeClient.java
index d9da6baf..4d338a53 100755
--- a/framework/src/org/apache/cordova/CordovaChromeClient.java
+++ b/framework/src/org/apache/cordova/CordovaChromeClient.java
@@ -222,6 +222,7 @@ public class CordovaChromeClient extends WebChromeClient {
result.confirm(r == null ? "" : r);
} catch (JSONException e) {
e.printStackTrace();
+ return false;
}
}
@@ -286,7 +287,7 @@ public class CordovaChromeClient extends WebChromeClient {
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
{
- LOG.d(TAG, "DroidGap: onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
+ LOG.d(TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
if (estimatedSize < MAX_QUOTA)
{
diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java
index c57cd505..9796ed83 100755
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -485,7 +485,7 @@ public class CordovaWebView extends WebView {
// If first page, then show splashscreen
else {
- LOG.d(TAG, "DroidGap.loadUrl(%s, %d)", url, time);
+ LOG.d(TAG, "loadUrlIntoView(%s, %d)", url, time);
// Send message to show splashscreen now if desired
this.postMessage("splashscreen", "show");
@@ -555,7 +555,7 @@ public class CordovaWebView extends WebView {
* @param url The url to load.
* @param openExternal Load url in browser instead of Cordova webview.
* @param clearHistory Clear the history stack, so new page becomes top of history
- * @param params DroidGap parameters for new app
+ * @param params Parameters for new app
*/
public void showWebPage(String url, boolean openExternal, boolean clearHistory, HashMap params) {
LOG.d(TAG, "showWebPage(%s, %b, %b, HashMap", url, openExternal, clearHistory);
@@ -601,7 +601,7 @@ public class CordovaWebView extends WebView {
/**
* Check configuration parameters from Config.
- * Approved list of URLs that can be loaded into DroidGap
+ * Approved list of URLs that can be loaded into Cordova
*
* Log level: ERROR, WARN, INFO, DEBUG, VERBOSE (default=ERROR)
*
diff --git a/framework/src/org/apache/cordova/Device.java b/framework/src/org/apache/cordova/Device.java
index d9d99282..b1cb2bb8 100644
--- a/framework/src/org/apache/cordova/Device.java
+++ b/framework/src/org/apache/cordova/Device.java
@@ -101,7 +101,7 @@ public class Device extends CordovaPlugin {
/**
* Listen for telephony events: RINGING, OFFHOOK and IDLE
* Send these events to all plugins using
- * DroidGap.onMessage("telephone", "ringing" | "offhook" | "idle")
+ * CordovaActivity.onMessage("telephone", "ringing" | "offhook" | "idle")
*/
private void initTelephonyReceiver() {
IntentFilter intentFilter = new IntentFilter();
diff --git a/framework/src/org/apache/cordova/FileHelper.java b/framework/src/org/apache/cordova/FileHelper.java
index 8bc24aa1..ebbdc8df 100644
--- a/framework/src/org/apache/cordova/FileHelper.java
+++ b/framework/src/org/apache/cordova/FileHelper.java
@@ -26,11 +26,10 @@ import org.apache.cordova.api.CordovaInterface;
import org.apache.cordova.api.LOG;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
+import java.net.URLConnection;
+import java.util.Locale;
public class FileHelper {
private static final String LOG_TAG = "FileUtils";
@@ -91,63 +90,24 @@ public class FileHelper {
* @throws IOException
*/
public static InputStream getInputStreamFromUriString(String uriString, CordovaInterface cordova) throws IOException {
- if (uriString.startsWith("content:")) {
+ if (uriString.startsWith("content")) {
Uri uri = Uri.parse(uriString);
return cordova.getActivity().getContentResolver().openInputStream(uri);
- } else if (uriString.startsWith("file:///android_asset/")) {
- Uri uri = Uri.parse(uriString);
- String relativePath = uri.getPath().substring(15);
- return cordova.getActivity().getAssets().open(relativePath);
} else if (uriString.startsWith("file://")) {
- return new FileInputStream(getRealPath(uriString, cordova));
- } else {
- return null;
- }
- }
-
- public static OutputStream getOutputStreamFromUriString(String uriString, CordovaInterface cordova) throws FileNotFoundException{
- if (uriString.startsWith("content:")) {
- Uri uri = Uri.parse(uriString);
- return cordova.getActivity().getContentResolver().openOutputStream(uri);
- } else if (uriString.startsWith("file:") && !uriString.startsWith("file:///android_asset/")) {
- String realPath = uriString.substring(7);
- return new FileOutputStream(realPath);
- } else {
- return null;
- }
- }
- /**
- * Returns whether the uri can be written to by openeing a File to that uri
- *
- * @param the URI to test
- * @return boolean indicating whether the uri is writable
- */
- public static boolean isUriWritable(String uriString) {
- String scheme = uriString.split(":")[0];
-
- if(scheme.equals("file")){
- // special case file
- return !uriString.startsWith("file:///android_asset/");
- }
- return "content".equals(scheme);
- }
-
- /**
- * Ensures the "file://" prefix exists for the given string
- * If the given URI string already has a scheme, it is returned unchanged
- *
- * @param path - the path string to operate on
- * @return a String with the "file://" scheme set
- */
- public static String insertFileProtocol(String path) {
- if(!path.matches("^[a-z0-9+.-]+:.*")){
- //Ensure it is not a relative path
- if(!path.startsWith("/")){
- throw new IllegalArgumentException("Relative paths" + path + "are not allowed.");
+ int question = uriString.indexOf("?");
+ if (question > -1) {
+ uriString = uriString.substring(0,question);
}
- path = "file://" + path;
+ if (uriString.startsWith("file:///android_asset/")) {
+ Uri uri = Uri.parse(uriString);
+ String relativePath = uri.getPath().substring(15);
+ return cordova.getActivity().getAssets().open(relativePath);
+ } else {
+ return new FileInputStream(getRealPath(uriString, cordova));
+ }
+ } else {
+ return new FileInputStream(getRealPath(uriString, cordova));
}
- return path;
}
/**
diff --git a/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java b/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
index 14c76037..847972ee 100644
--- a/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
+++ b/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
@@ -22,8 +22,6 @@ import java.io.IOException;
import java.io.InputStream;
import org.apache.cordova.api.CordovaInterface;
-import org.apache.cordova.api.DataResource;
-import org.apache.cordova.api.DataResourceContext;
import org.apache.cordova.api.LOG;
import android.annotation.TargetApi;
@@ -45,27 +43,41 @@ public class IceCreamCordovaWebViewClient extends CordovaWebViewClient {
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
- // We need to support the new DataResource intercepts without breaking the shouldInterceptRequest mechanism.
- DataResource dataResource = DataResource.initiateNewDataRequestForUri(url, this.appView.pluginManager, cordova,
- "WebViewClient.shouldInterceptRequest");
- url = dataResource.getUri().toString();
-
- // This mechanism is no longer needed due to the dataResource mechanism. It would be awesome to just get rid of it.
//Check if plugins intercept the request
WebResourceResponse ret = super.shouldInterceptRequest(view, url);
-
- if(ret == null) {
- try {
- InputStream is;
- String mimeType;
- if((is = dataResource.getInputStream()) != null && (mimeType = dataResource.getMimeType()) != null) {
- // If we don't know how to open this file, let the browser continue loading
- ret = new WebResourceResponse(mimeType, "UTF-8", is);
- }
- } catch(IOException e) {
- LOG.e("IceCreamCordovaWebViewClient", "Error occurred while loading a file.", e);
- }
+ if(ret == null && (url.contains("?") || url.contains("#") || needsIceCreamSpaceInAssetUrlFix(url))){
+ ret = generateWebResourceResponse(url);
}
return ret;
}
+
+ private WebResourceResponse generateWebResourceResponse(String url) {
+ if (url.startsWith("file:///android_asset/")) {
+ String mimetype = FileHelper.getMimeType(url, cordova);
+
+ try {
+ InputStream stream = FileHelper.getInputStreamFromUriString(url, cordova);
+ WebResourceResponse response = new WebResourceResponse(mimetype, "UTF-8", stream);
+ return response;
+ } catch (IOException e) {
+ LOG.e("generateWebResourceResponse", e.getMessage(), e);
+ }
+ }
+ return null;
+ }
+
+ private static boolean needsIceCreamSpaceInAssetUrlFix(String url) {
+ if (!url.contains("%20")){
+ return false;
+ }
+
+ switch(android.os.Build.VERSION.SDK_INT){
+ case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH:
+ case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1:
+ return true;
+ default:
+ return false;
+ }
+ }
+
}
diff --git a/framework/src/org/apache/cordova/JSONUtils.java b/framework/src/org/apache/cordova/JSONUtils.java
index 77df8764..da777c16 100644
--- a/framework/src/org/apache/cordova/JSONUtils.java
+++ b/framework/src/org/apache/cordova/JSONUtils.java
@@ -1,3 +1,21 @@
+/*
+ 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.
+*/
package org.apache.cordova;
import java.util.ArrayList;
diff --git a/framework/src/org/apache/cordova/api/CallbackContext.java b/framework/src/org/apache/cordova/api/CallbackContext.java
index a5d1255c..237d0f4d 100644
--- a/framework/src/org/apache/cordova/api/CallbackContext.java
+++ b/framework/src/org/apache/cordova/api/CallbackContext.java
@@ -1,3 +1,21 @@
+/*
+ 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.
+*/
package org.apache.cordova.api;
import org.json.JSONArray;
diff --git a/framework/src/org/apache/cordova/api/CordovaInterface.java b/framework/src/org/apache/cordova/api/CordovaInterface.java
index aaa5885a..8ef8ed01 100755
--- a/framework/src/org/apache/cordova/api/CordovaInterface.java
+++ b/framework/src/org/apache/cordova/api/CordovaInterface.java
@@ -24,7 +24,7 @@ import android.content.Intent;
import java.util.concurrent.ExecutorService;
/**
- * The Cordova activity abstract class that is extended by DroidGap.
+ * The Activity interface that is implemented by CordovaActivity.
* It is used to isolate plugin development, and remove dependency on entire Cordova library.
*/
public interface CordovaInterface {
diff --git a/framework/src/org/apache/cordova/api/CordovaPlugin.java b/framework/src/org/apache/cordova/api/CordovaPlugin.java
index 866677c3..2b225e64 100644
--- a/framework/src/org/apache/cordova/api/CordovaPlugin.java
+++ b/framework/src/org/apache/cordova/api/CordovaPlugin.java
@@ -175,20 +175,6 @@ public class CordovaPlugin {
return null;
}
- /**
- * All plugins can now choose if they want to modify any uri requests. This includes all webview requests, opening of files, content uri's etc.
- * This mechanism allows several plugins to modify the same request
- * @param requestSource The source of the incoming request
- *
- * @param dataResource The resource to be loaded.
- * @param dataResourceContext Context associated with the resource load
- * @return Return a new DataResource if the plugin wants to assist in loading the request or null if it doesn't.
- */
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public DataResource handleDataResourceRequest(DataResource dataResource, DataResourceContext dataResourceContext) {
- return null;
- }
-
/**
* Called when the WebView does a top-level navigation or refreshes.
*
diff --git a/framework/src/org/apache/cordova/api/DataResource.java b/framework/src/org/apache/cordova/api/DataResource.java
deleted file mode 100644
index 3e6ead87..00000000
--- a/framework/src/org/apache/cordova/api/DataResource.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.apache.cordova.api;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.cordova.FileHelper;
-
-import android.net.Uri;
-
-/*
- * All requests to access files, browser network requests etc have to go through this class.
- */
-public class DataResource {
- private CordovaInterface cordova;
-
- // Uri of the request. Always required.
- private Uri uri;
- // Remaining fields may or may not be null
- private InputStream is;
- private OutputStream os;
- private String mimeType;
- private Boolean writable;
- private File realFile;
- private boolean retryIsLoad = true;
- private boolean retryOsLoad = true;
- private boolean retryMimeTypeLoad = true;
- private boolean retryWritableLoad = true;
- private boolean retryRealFileLoad = true;
-
- public DataResource(CordovaInterface cordova, Uri uri) {
- this.cordova = cordova;
- this.uri = uri;
- }
- public DataResource(CordovaInterface cordova, Uri uri, InputStream is,
- OutputStream os, String mimeType, boolean writable, File realFile) {
- this(cordova, uri);
- this.is = is;
- this.mimeType = mimeType;
- this.writable = Boolean.valueOf(writable);
- this.realFile = realFile;
- }
- public Uri getUri() {
- // Uri is always provided
- return uri;
- }
- public InputStream getInputStream() throws IOException {
- if(is == null && retryIsLoad) {
- try {
- is = FileHelper.getInputStreamFromUriString(uri.toString(), cordova);
- } finally {
- // We failed loading once, don't try loading anymore
- if(is == null) {
- retryIsLoad = false;
- }
- }
- }
- return is;
- }
- public OutputStream getOutputStream() throws FileNotFoundException {
- if(os == null && retryOsLoad) {
- try {
- os = FileHelper.getOutputStreamFromUriString(uri.toString(), cordova);
- } finally {
- // We failed loading once, don't try loading anymore
- if(os == null) {
- retryOsLoad = false;
- }
- }
- }
- return os;
- }
- public String getMimeType() {
- if(mimeType == null && retryMimeTypeLoad) {
- try {
- mimeType = FileHelper.getMimeType(uri.toString(), cordova);
- } finally {
- // We failed loading once, don't try loading anymore
- if(mimeType == null) {
- retryMimeTypeLoad = false;
- }
- }
- }
- return mimeType;
- }
- public boolean isWritable() {
- if(writable == null && retryWritableLoad) {
- try {
- writable = FileHelper.isUriWritable(uri.toString());
- } finally {
- // We failed loading once, don't try loading anymore
- if(writable == null) {
- retryWritableLoad = false;
- }
- }
- }
- // default to false
- return writable != null && writable.booleanValue();
- }
- public File getRealFile() {
- if(realFile == null && retryRealFileLoad) {
- try {
- String realPath = FileHelper.getRealPath(uri, cordova);
- if(realPath != null) {
- realFile = new File(realPath);
- }
- } finally {
- // We failed loading once, don't try loading anymore
- if(realFile == null) {
- retryRealFileLoad = false;
- }
- }
- }
- return realFile;
- }
-
- // static instantiation methods
- public static DataResource initiateNewDataRequestForUri(String uriString, PluginManager pluginManager, CordovaInterface cordova, String requestSourceTag){
- // if no protocol is specified, assume its file:
- uriString = FileHelper.insertFileProtocol(uriString);
- return initiateNewDataRequestForUri(Uri.parse(uriString), pluginManager, cordova, requestSourceTag);
- }
- public static DataResource initiateNewDataRequestForUri(Uri uri, PluginManager pluginManager, CordovaInterface cordova, String requestSourceTag){
- return initiateNewDataRequestForUri(uri, pluginManager, cordova, new DataResourceContext(requestSourceTag));
- }
- public static DataResource initiateNewDataRequestForUri(String uriString, PluginManager pluginManager, CordovaInterface cordova, DataResourceContext dataResourceContext){
- // if no protocol is specified, assume its file:
- uriString = FileHelper.insertFileProtocol(uriString);
- return initiateNewDataRequestForUri(Uri.parse(uriString), pluginManager, cordova, dataResourceContext);
- }
- public static DataResource initiateNewDataRequestForUri(Uri uri, PluginManager pluginManager, CordovaInterface cordova, DataResourceContext dataResourceContext){
- DataResource dataResource = new DataResource(cordova, uri);
- if (pluginManager != null) {
- // get the resource as returned by plugins
- dataResource = pluginManager.handleDataResourceRequestWithPlugins(dataResource, dataResourceContext);
- }
- return dataResource;
- }
-}
diff --git a/framework/src/org/apache/cordova/api/DataResourceContext.java b/framework/src/org/apache/cordova/api/DataResourceContext.java
deleted file mode 100644
index 310586b2..00000000
--- a/framework/src/org/apache/cordova/api/DataResourceContext.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.apache.cordova.api;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-/*
- * Some context information associated with a DataRequest.
- */
-public class DataResourceContext {
- // A random id that is unique for a particular request.
- private int requestId;
- // A tag associated with the source of this dataResourceContext
- private String source;
- // If needed, any data associated with core plugins can be a part of the context object
- // If needed, any data associated with non core plugins should store data in a Map so as to not clutter the context object
- private Map dataMap;
- public DataResourceContext(String source) {
- this.requestId = new Random().nextInt();
- this.source = source;
- this.dataMap = new HashMap();
- }
- public int getRequestId() {
- return requestId;
- }
- public String getSource() {
- return source;
- }
- public Map getDataMap() {
- return dataMap;
- }
-}
diff --git a/framework/src/org/apache/cordova/api/PluginManager.java b/framework/src/org/apache/cordova/api/PluginManager.java
index e0ceabfb..71fc2581 100755
--- a/framework/src/org/apache/cordova/api/PluginManager.java
+++ b/framework/src/org/apache/cordova/api/PluginManager.java
@@ -54,7 +54,6 @@ public class PluginManager {
// Map URL schemes like foo: to plugins that want to handle those schemes
// This would allow how all URLs are handled to be offloaded to a plugin
protected HashMap urlMap = new HashMap();
- private int MAX_REPITIONS = 1000;
/**
* Constructor.
@@ -401,32 +400,4 @@ public class PluginManager {
LOG.e(TAG, "https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/res/xml/plugins.xml");
LOG.e(TAG, "=====================================================================================");
}
-
- /**
- * Called when the any resource is going to be loaded - either from the webview, files or any other resource
- *
- *
- * @param dataResource The resource request to be loaded.
- * @param dataResourceContext The context of the dataResource request
- * @return Return the resource request that will be loaded. The returned request may be modified or unchanged.
- */
- public DataResource handleDataResourceRequestWithPlugins(DataResource dataResource, DataResourceContext dataResourceContext){
- int repetitions = 0;
- boolean requestModified = true;
- while(requestModified && repetitions < MAX_REPITIONS) {
- requestModified = false;
- repetitions ++;
- for (PluginEntry entry : this.entries.values()) {
- if (entry.plugin != null) {
- DataResource ret = entry.plugin.handleDataResourceRequest(dataResource, dataResourceContext);
- if(ret != null) {
- dataResource = ret;
- requestModified = true;
- break;
- }
- }
- }
- }
- return dataResource;
- }
}
diff --git a/test/README.md b/test/README.md
index 79cf85ff..5d867201 100755
--- a/test/README.md
+++ b/test/README.md
@@ -1,3 +1,23 @@
+
# Android Native Tests #
These tests are designed to verify Android native features and other Android specific features.
diff --git a/test/res/xml/config.xml b/test/res/xml/config.xml
index d3ea4d86..5ad2b25a 100644
--- a/test/res/xml/config.xml
+++ b/test/res/xml/config.xml
@@ -1,4 +1,22 @@
+