From 664a061d10e2db79e05a0c5e2a1b5afe5e76d08b Mon Sep 17 00:00:00 2001 From: macdonst Date: Wed, 1 Feb 2012 20:45:49 -0500 Subject: [PATCH] Rename to Cordova --- .gitignore | 8 +- README.md | 14 +- bin/BOOM | 2 +- bin/bench | 12 +- bin/create | 22 +- bin/create.js | 16 +- bin/create.xml | 16 +- .../{.phonegap => .cordova}/android/readme.md | 0 .../project/{.phonegap => .cordova}/readme.md | 2 +- .../project/{phonegap => cordova}/create | 18 +- .../project/{phonegap => cordova}/debug | 2 +- .../project/{phonegap => cordova}/emulate | 0 .../project/{phonegap => cordova}/log | 0 .../templates/Activity.java | 2 +- .../templates/project/AndroidManifest.xml | 2 +- .../templates/project/assets/www/index.html | 2 +- .../templates/project/assets/www/main.js | 0 .../templates/project/assets/www/master.css | 0 .../templates/project/res/drawable/icon.png | Bin .../templates/project/res/xml/cordova.xml} | 4 +- .../templates/project/res/xml/plugins.xml | 19 + .../templates/project/res/xml/plugins.xml | 19 - bin/test | 8 +- bin/tests/create.coffee | 12 +- framework/.project | 2 +- framework/AndroidManifest.xml | 4 +- framework/assets/js/accelerometer.js | 16 +- framework/assets/js/app.js | 18 +- framework/assets/js/battery.js | 22 +- framework/assets/js/camera.js | 8 +- framework/assets/js/capture.js | 14 +- framework/assets/js/compass.js | 16 +- framework/assets/js/contact.js | 14 +- .../js/{phonegap.js.base => cordova.js.base} | 344 +++++++++--------- framework/assets/js/crypto.js | 10 +- framework/assets/js/device.js | 20 +- framework/assets/js/file.js | 48 +-- framework/assets/js/filetransfer.js | 8 +- framework/assets/js/geolocation.js | 28 +- framework/assets/js/media.js | 38 +- framework/assets/js/network.js | 18 +- framework/assets/js/notification.js | 24 +- framework/assets/js/position.js | 4 +- framework/assets/js/storage.js | 18 +- framework/assets/www/index.html | 2 +- framework/build.xml | 44 +-- framework/res/values/strings.xml | 2 +- .../res/xml/{phonegap.xml => cordova.xml} | 4 +- framework/res/xml/plugins.xml | 32 +- .../apache/cordova}/AccelListener.java | 10 +- .../phonegap => org/apache/cordova}/App.java | 8 +- .../apache/cordova}/AudioHandler.java | 11 +- .../apache/cordova}/AudioPlayer.java | 32 +- .../apache/cordova}/AuthenticationToken.java | 2 +- .../apache/cordova}/BatteryListener.java | 6 +- .../apache/cordova}/CallbackServer.java | 10 +- .../apache/cordova}/CameraLauncher.java | 10 +- .../apache/cordova}/Capture.java | 8 +- .../apache/cordova}/CompassListener.java | 10 +- .../apache/cordova}/ContactAccessor.java | 2 +- .../apache/cordova}/ContactAccessorSdk5.java | 2 +- .../apache/cordova}/ContactManager.java | 8 +- .../apache/cordova}/CordovaChromeClient.java | 8 +- .../apache/cordova}/CordovaWebViewClient.java | 10 +- .../apache/cordova}/Device.java | 29 +- .../apache/cordova}/DirectoryManager.java | 2 +- .../apache/cordova}/DroidGap.java | 64 ++-- .../apache/cordova}/ExifHelper.java | 2 +- .../apache/cordova}/FileTransfer.java | 8 +- .../apache/cordova}/FileUploadResult.java | 2 +- .../apache/cordova}/FileUtils.java | 20 +- .../apache/cordova}/GeoBroker.java | 6 +- .../apache/cordova}/GeoListener.java | 2 +- .../apache/cordova}/GpsListener.java | 8 +- .../apache/cordova}/HttpHandler.java | 2 +- .../LinearLayoutSoftKeyboardDetect.java | 8 +- .../apache/cordova}/NetworkListener.java | 20 +- .../apache/cordova}/NetworkManager.java | 10 +- .../apache/cordova}/Notification.java | 16 +- .../apache/cordova}/PreferenceNode.java | 2 +- .../apache/cordova}/PreferenceSet.java | 5 +- .../apache/cordova}/StandAlone.java | 2 +- .../apache/cordova}/Storage.java | 6 +- .../apache/cordova}/TempListener.java | 10 +- .../apache/cordova/api/CordovaActivity.java} | 10 +- .../apache/cordova}/api/IPlugin.java | 10 +- .../apache/cordova}/api/LOG.java | 6 +- .../apache/cordova}/api/Plugin.java | 12 +- .../apache/cordova}/api/PluginManager.java | 27 +- .../apache/cordova}/api/PluginResult.java | 8 +- .../cordova}/file/EncodingException.java | 2 +- .../cordova}/file/FileExistsException.java | 2 +- .../file/InvalidModificationException.java | 2 +- .../file/NoModificationAllowedException.java | 2 +- .../cordova}/file/TypeMismatchException.java | 2 +- .../apache/cordova}/PreferenceNodeTest.java | 10 +- .../apache/cordova}/PreferenceSetTest.java | 4 +- 97 files changed, 699 insertions(+), 697 deletions(-) rename bin/templates/project/{.phonegap => .cordova}/android/readme.md (100%) rename bin/templates/project/{.phonegap => .cordova}/readme.md (54%) rename bin/templates/project/{phonegap => cordova}/create (70%) rename bin/templates/project/{phonegap => cordova}/debug (86%) rename bin/templates/project/{phonegap => cordova}/emulate (100%) rename bin/templates/project/{phonegap => cordova}/log (100%) rename bin/templates/project/{phonegap => cordova}/templates/Activity.java (91%) rename bin/templates/project/{phonegap => cordova}/templates/project/AndroidManifest.xml (96%) rename bin/templates/project/{phonegap => cordova}/templates/project/assets/www/index.html (95%) rename bin/templates/project/{phonegap => cordova}/templates/project/assets/www/main.js (100%) rename bin/templates/project/{phonegap => cordova}/templates/project/assets/www/master.css (100%) rename bin/templates/project/{phonegap => cordova}/templates/project/res/drawable/icon.png (100%) rename bin/templates/project/{phonegap/templates/project/res/xml/phonegap.xml => cordova/templates/project/res/xml/cordova.xml} (82%) create mode 100644 bin/templates/project/cordova/templates/project/res/xml/plugins.xml delete mode 100644 bin/templates/project/phonegap/templates/project/res/xml/plugins.xml rename framework/assets/js/{phonegap.js.base => cordova.js.base} (65%) rename framework/res/xml/{phonegap.xml => cordova.xml} (96%) rename framework/src/{com/phonegap => org/apache/cordova}/AccelListener.java (97%) rename framework/src/{com/phonegap => org/apache/cordova}/App.java (97%) rename framework/src/{com/phonegap => org/apache/cordova}/AudioHandler.java (98%) rename framework/src/{com/phonegap => org/apache/cordova}/AudioPlayer.java (88%) rename framework/src/{com/phonegap => org/apache/cordova}/AuthenticationToken.java (97%) rename framework/src/{com/phonegap => org/apache/cordova}/BatteryListener.java (98%) rename framework/src/{com/phonegap => org/apache/cordova}/CallbackServer.java (98%) rename framework/src/{com/phonegap => org/apache/cordova}/CameraLauncher.java (98%) rename framework/src/{com/phonegap => org/apache/cordova}/Capture.java (99%) rename framework/src/{com/phonegap => org/apache/cordova}/CompassListener.java (97%) rename framework/src/{com/phonegap => org/apache/cordova}/ContactAccessor.java (99%) rename framework/src/{com/phonegap => org/apache/cordova}/ContactAccessorSdk5.java (99%) rename framework/src/{com/phonegap => org/apache/cordova}/ContactManager.java (96%) rename framework/src/{com/phonegap => org/apache/cordova}/CordovaChromeClient.java (98%) rename framework/src/{com/phonegap => org/apache/cordova}/CordovaWebViewClient.java (96%) rename framework/src/{com/phonegap => org/apache/cordova}/Device.java (91%) rename framework/src/{com/phonegap => org/apache/cordova}/DirectoryManager.java (99%) rename framework/src/{com/phonegap => org/apache/cordova}/DroidGap.java (95%) rename framework/src/{com/phonegap => org/apache/cordova}/ExifHelper.java (99%) rename framework/src/{com/phonegap => org/apache/cordova}/FileTransfer.java (98%) rename framework/src/{com/phonegap => org/apache/cordova}/FileUploadResult.java (98%) rename framework/src/{com/phonegap => org/apache/cordova}/FileUtils.java (98%) rename framework/src/{com/phonegap => org/apache/cordova}/GeoBroker.java (97%) rename framework/src/{com/phonegap => org/apache/cordova}/GeoListener.java (99%) rename framework/src/{com/phonegap => org/apache/cordova}/GpsListener.java (95%) rename framework/src/{com/phonegap => org/apache/cordova}/HttpHandler.java (98%) rename framework/src/{com/phonegap => org/apache/cordova}/LinearLayoutSoftKeyboardDetect.java (94%) rename framework/src/{com/phonegap => org/apache/cordova}/NetworkListener.java (85%) rename framework/src/{com/phonegap => org/apache/cordova}/NetworkManager.java (97%) rename framework/src/{com/phonegap => org/apache/cordova}/Notification.java (97%) rename framework/src/{com/phonegap => org/apache/cordova}/PreferenceNode.java (94%) rename framework/src/{com/phonegap => org/apache/cordova}/PreferenceSet.java (92%) rename framework/src/{com/phonegap => org/apache/cordova}/StandAlone.java (97%) rename framework/src/{com/phonegap => org/apache/cordova}/Storage.java (98%) rename framework/src/{com/phonegap => org/apache/cordova}/TempListener.java (94%) rename framework/src/{com/phonegap/api/PhonegapActivity.java => org/apache/cordova/api/CordovaActivity.java} (91%) rename framework/src/{com/phonegap => org/apache/cordova}/api/IPlugin.java (96%) rename framework/src/{com/phonegap => org/apache/cordova}/api/LOG.java (96%) rename framework/src/{com/phonegap => org/apache/cordova}/api/Plugin.java (97%) rename framework/src/{com/phonegap => org/apache/cordova}/api/PluginManager.java (92%) rename framework/src/{com/phonegap => org/apache/cordova}/api/PluginResult.java (92%) rename framework/src/{com/phonegap => org/apache/cordova}/file/EncodingException.java (96%) rename framework/src/{com/phonegap => org/apache/cordova}/file/FileExistsException.java (96%) rename framework/src/{com/phonegap => org/apache/cordova}/file/InvalidModificationException.java (96%) rename framework/src/{com/phonegap => org/apache/cordova}/file/NoModificationAllowedException.java (96%) rename framework/src/{com/phonegap => org/apache/cordova}/file/TypeMismatchException.java (96%) rename framework/test/{com/phonegap => org/apache/cordova}/PreferenceNodeTest.java (62%) rename framework/test/{com/phonegap => org/apache/cordova}/PreferenceSetTest.java (94%) diff --git a/.gitignore b/.gitignore index b83f1e9a..06496d7a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,16 @@ .DS_Store default.properties gen -assets/www/phonegap.js +assets/www/cordova.js local.properties framework/proguard.cfg -framework/phonegap.jar +framework/cordova.jar +framework/cordova-*.jar framework/phonegap-*.jar framework/bin -framework/test/com/phonegap/*.class +framework/test/org/apache/cordova/*.class framework/assets/www/.DS_Store +framework/assets/www/cordova-*.js framework/assets/www/phonegap-*.js example ./test diff --git a/README.md b/README.md index ea999ffb..b80e670c 100755 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Requires Building --- -To create your phonegap.jar, run in the framework directory: +To create your cordova.jar, run in the framework directory: android update project -p . -t android-15 ant jar @@ -45,9 +45,9 @@ Project Commands These commands live in a generated Cordova Android project. - ./phonegap/debug [path] ..................... install to first device - ./phonegap/emulate .......................... start avd (emulator) named default - ./phonegap/log .............................. starts logcat + ./cordovap/debug [path] ..................... install to first device + ./cordova/emulate .......................... start avd (emulator) named default + ./cordova/log .............................. starts logcat Running the Example Project --- @@ -60,11 +60,11 @@ Create the example project and build it to the first device: ./bin/create cd example - ./phonegap/debug + ./cordova/debug Start adb logcat (console.log calls output here): - ./phonegap/log + ./cordova/log Running the [callback/callback-test](http://github.com/callback/callback-test) tests: --- @@ -82,7 +82,7 @@ Importing a Cordova Android Project into Eclipse 1. File > New > Project... 2. Android > Android Project 3. Create project from existing source (point to the generated app found in tmp/android) -4. Right click on libs/phonegap.jar and add to build path +4. Right click on libs/cordova.jar and add to build path 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) diff --git a/bin/BOOM b/bin/BOOM index 2293406a..fa33b0a3 100755 --- a/bin/BOOM +++ b/bin/BOOM @@ -1,4 +1,4 @@ #! /bin/sh ./bin/create -cd ./example && ./phonegap/debug && ./phonegap/log +cd ./example && ./cordova/debug && ./cordova/log diff --git a/bin/bench b/bin/bench index 3fa2d2a8..9a2663eb 100755 --- a/bin/bench +++ b/bin/bench @@ -1,6 +1,6 @@ #! /bin/sh # -# Creates an app in `./bench` that posts results to http://phonegap-bench.heroku.com with current PhoneGap/Android sha. +# Creates an app in `./bench` that posts results to http://cordova-bench.heroku.com with current cordova/Android sha. # # USAGE # ./bin/bench @@ -13,17 +13,17 @@ then fi # create a benching app -./bin/create ./bench com.phonegap.bench PhoneGapBench +./bin/create ./bench org.apache.cordova.bench cordovaBench # grab the latest bench www code -git clone git@github.com:brianleroux/phonegap-bench.git +git clone git@github.com:brianleroux/cordova-bench.git # copy it into the app -cat ./phonegap-bench/www/index.html > ./bench/assets/www/index.html -#cat ~/Desktop/phonegap-bench/www/index.html > ./bench/assets/www/index.html +cat ./cordova-bench/www/index.html > ./bench/assets/www/index.html +#cat ~/Desktop/cordova-bench/www/index.html > ./bench/assets/www/index.html # clean up -rm -rf ./phonegap-bench +rm -rf ./cordova-bench # launch to the first device found ./bin/debug ./bench diff --git a/bin/create b/bin/create index 0672c160..1f2a4210 100755 --- a/bin/create +++ b/bin/create @@ -1,6 +1,6 @@ #! /bin/sh # -# create a phonegap/android project +# create a cordova/android project # # USAGE # ./create [path package activity] @@ -8,8 +8,8 @@ set -e PROJECT_PATH=${1:-"./example"} -PACKAGE=${2:-"com.phonegap.example"} -ACTIVITY=${3:-"PhoneGapExample"} +PACKAGE=${2:-"org.apache.cordova.example"} +ACTIVITY=${3:-"cordovaExample"} TARGET=$(android list targets | grep 'id: ' | sed 's/id: \([0-9]*\).*/\1/g' | tail -1) VERSION=$(cat ./VERSION) @@ -19,23 +19,23 @@ then rm -rf $PROJECT_PATH fi -# update the phonegap-android framework for the desired target +# update the cordova-android framework for the desired target android update project --target $TARGET --path ./framework -# compile phonegap.js and phonegap.jar +# compile cordova.js and cordova.jar cd ./framework && ant jar && cd ../ # copy all the bin scripts etc in there cp -R ./bin/templates/project/ $PROJECT_PATH -# copy in phonegap.js -cp ./framework/assets/www/phonegap-$VERSION.js $PROJECT_PATH/.phonegap/android/phonegap-$VERSION.js +# copy in cordova.js +cp ./framework/assets/www/cordova-$VERSION.js $PROJECT_PATH/.cordova/android/cordova-$VERSION.js -# copy in phonegap.jar -cp ./framework/phonegap-$VERSION.jar $PROJECT_PATH/.phonegap/android/phonegap-$VERSION.jar +# copy in cordova.jar +cp ./framework/cordova-$VERSION.jar $PROJECT_PATH/.cordova/android/cordova-$VERSION.jar # app properties -cat > $PROJECT_PATH/.phonegap/config < $PROJECT_PATH/.cordova/config < - + - - + + @@ -50,7 +50,7 @@ - + @@ -60,11 +60,11 @@ - - + + - - + + diff --git a/bin/templates/project/.phonegap/android/readme.md b/bin/templates/project/.cordova/android/readme.md similarity index 100% rename from bin/templates/project/.phonegap/android/readme.md rename to bin/templates/project/.cordova/android/readme.md diff --git a/bin/templates/project/.phonegap/readme.md b/bin/templates/project/.cordova/readme.md similarity index 54% rename from bin/templates/project/.phonegap/readme.md rename to bin/templates/project/.cordova/readme.md index 7028aab8..ad8d878b 100644 --- a/bin/templates/project/.phonegap/readme.md +++ b/bin/templates/project/.cordova/readme.md @@ -1,3 +1,3 @@ -this is local config for phonegap stuff to be eventually moved to +this is local config for cordova stuff to be eventually moved to config.xml ...we think. feedback to @davejohnson/@brianleroux appreciated here! diff --git a/bin/templates/project/phonegap/create b/bin/templates/project/cordova/create similarity index 70% rename from bin/templates/project/phonegap/create rename to bin/templates/project/cordova/create index 076424a2..32f1e165 100755 --- a/bin/templates/project/phonegap/create +++ b/bin/templates/project/cordova/create @@ -1,13 +1,13 @@ #! /bin/sh # -# create a phonegap/android project +# create a cordova/android project # # USAGE # ./create [path package activity] # # load up the config -. ./.phonegap/config +. ./.cordova/config PACKAGE_AS_PATH=$(echo $PACKAGE | sed 's/\./\//g') ACTIVITY_PATH=./src/$PACKAGE_AS_PATH/$ACTIVITY.java @@ -16,17 +16,17 @@ MANIFEST_PATH=./AndroidManifest.xml # create the project android create project --target $TARGET --path . --package $PACKAGE --activity $ACTIVITY -# copy all the phonegap scripts etc in there -cp -R ./phonegap/templates/project/* . +# copy all the cordova scripts etc in there +cp -R ./cordova/templates/project/* . -# copy in phonegap.js -cp ./.phonegap/android/phonegap-$VERSION.js ./assets/www +# copy in cordova.js +cp ./.cordova/android/cordova-$VERSION.js ./assets/www -# copy in phonegap.jar -cp ./.phonegap/android/phonegap-$VERSION.jar ./libs +# copy in cordova.jar +cp ./.cordova/android/cordova-$VERSION.jar ./libs # copy in default activity -cat ./phonegap/templates/Activity.java > $ACTIVITY_PATH +cat ./cordova/templates/Activity.java > $ACTIVITY_PATH # interpolate the acivity name and package find "$ACTIVITY_PATH" | xargs grep '__ACTIVITY__' -sl | xargs -L1 sed -i -e "s/__ACTIVITY__/${ACTIVITY}/g" diff --git a/bin/templates/project/phonegap/debug b/bin/templates/project/cordova/debug similarity index 86% rename from bin/templates/project/phonegap/debug rename to bin/templates/project/cordova/debug index bfa3df1c..8dd31874 100755 --- a/bin/templates/project/phonegap/debug +++ b/bin/templates/project/cordova/debug @@ -1,6 +1,6 @@ #! /bin/sh -. ./.phonegap/config +. ./.cordova/config # if there are no devices listed then emulate diff --git a/bin/templates/project/phonegap/emulate b/bin/templates/project/cordova/emulate similarity index 100% rename from bin/templates/project/phonegap/emulate rename to bin/templates/project/cordova/emulate diff --git a/bin/templates/project/phonegap/log b/bin/templates/project/cordova/log similarity index 100% rename from bin/templates/project/phonegap/log rename to bin/templates/project/cordova/log diff --git a/bin/templates/project/phonegap/templates/Activity.java b/bin/templates/project/cordova/templates/Activity.java similarity index 91% rename from bin/templates/project/phonegap/templates/Activity.java rename to bin/templates/project/cordova/templates/Activity.java index 54e27070..60ad6a23 100644 --- a/bin/templates/project/phonegap/templates/Activity.java +++ b/bin/templates/project/cordova/templates/Activity.java @@ -2,7 +2,7 @@ package __ID__; import android.app.Activity; import android.os.Bundle; -import com.phonegap.*; +import org.apache.cordova.*; public class __ACTIVITY__ extends DroidGap { diff --git a/bin/templates/project/phonegap/templates/project/AndroidManifest.xml b/bin/templates/project/cordova/templates/project/AndroidManifest.xml similarity index 96% rename from bin/templates/project/phonegap/templates/project/AndroidManifest.xml rename to bin/templates/project/cordova/templates/project/AndroidManifest.xml index 2269f379..d7cccc40 100644 --- a/bin/templates/project/phonegap/templates/project/AndroidManifest.xml +++ b/bin/templates/project/cordova/templates/project/AndroidManifest.xml @@ -39,7 +39,7 @@ - diff --git a/bin/templates/project/phonegap/templates/project/assets/www/index.html b/bin/templates/project/cordova/templates/project/assets/www/index.html similarity index 95% rename from bin/templates/project/phonegap/templates/project/assets/www/index.html rename to bin/templates/project/cordova/templates/project/assets/www/index.html index bfe03d6e..ec9a77f8 100644 --- a/bin/templates/project/phonegap/templates/project/assets/www/index.html +++ b/bin/templates/project/cordova/templates/project/assets/www/index.html @@ -5,7 +5,7 @@ PhoneGap - + diff --git a/bin/templates/project/phonegap/templates/project/assets/www/main.js b/bin/templates/project/cordova/templates/project/assets/www/main.js similarity index 100% rename from bin/templates/project/phonegap/templates/project/assets/www/main.js rename to bin/templates/project/cordova/templates/project/assets/www/main.js diff --git a/bin/templates/project/phonegap/templates/project/assets/www/master.css b/bin/templates/project/cordova/templates/project/assets/www/master.css similarity index 100% rename from bin/templates/project/phonegap/templates/project/assets/www/master.css rename to bin/templates/project/cordova/templates/project/assets/www/master.css diff --git a/bin/templates/project/phonegap/templates/project/res/drawable/icon.png b/bin/templates/project/cordova/templates/project/res/drawable/icon.png similarity index 100% rename from bin/templates/project/phonegap/templates/project/res/drawable/icon.png rename to bin/templates/project/cordova/templates/project/res/drawable/icon.png diff --git a/bin/templates/project/phonegap/templates/project/res/xml/phonegap.xml b/bin/templates/project/cordova/templates/project/res/xml/cordova.xml similarity index 82% rename from bin/templates/project/phonegap/templates/project/res/xml/phonegap.xml rename to bin/templates/project/cordova/templates/project/res/xml/cordova.xml index 97f31ea1..c7b50000 100755 --- a/bin/templates/project/phonegap/templates/project/res/xml/phonegap.xml +++ b/bin/templates/project/cordova/templates/project/res/xml/cordova.xml @@ -1,5 +1,5 @@ - + - + diff --git a/bin/templates/project/cordova/templates/project/res/xml/plugins.xml b/bin/templates/project/cordova/templates/project/res/xml/plugins.xml new file mode 100644 index 00000000..4c651eea --- /dev/null +++ b/bin/templates/project/cordova/templates/project/res/xml/plugins.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/bin/templates/project/phonegap/templates/project/res/xml/plugins.xml b/bin/templates/project/phonegap/templates/project/res/xml/plugins.xml deleted file mode 100644 index 3d8d48d8..00000000 --- a/bin/templates/project/phonegap/templates/project/res/xml/plugins.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bin/test b/bin/test index 226edd2d..abd97aa3 100755 --- a/bin/test +++ b/bin/test @@ -13,14 +13,14 @@ then fi # generate a working proj -./bin/create ./test com.phonegap.test PhoneGapTest +./bin/create ./test org.apache.cordova.test CordovaTest # kill the default app and replace it w/ mobile-spec rm -rf ./test/assets/www mv ./callback-test ./test/assets/www -# copy in phonegap.js since www dir was replaced above -cp ./framework/assets/www/phonegap-$VERSION.js ./test/assets/www/phonegap-$VERSION.js +# copy in cordova.js since www dir was replaced above +cp ./framework/assets/www/cordova-$VERSION.js ./test/assets/www/cordova-$VERSION.js # build it, launch it and start logging on stdout -cd ./test && ./phonegap/debug && ./phonegap/log +cd ./test && ./cordova/debug && ./cordova/log diff --git a/bin/tests/create.coffee b/bin/tests/create.coffee index 746e07b2..0ed37efc 100644 --- a/bin/tests/create.coffee +++ b/bin/tests/create.coffee @@ -8,14 +8,14 @@ exports['default example project is generated'] = (test) -> test.ok true, "this assertion should pass" unless error? test.done() -exports['default example project has a ./.phonegap folder'] = (test) -> +exports['default example project has a ./.cordova folder'] = (test) -> test.expect 1 - path.exists './example/.phonegap', (exists) -> - test.ok exists, 'the phonegap folder exists' + path.exists './example/.cordova', (exists) -> + test.ok exists, 'the cordova folder exists' test.done() -exports['default example project has a /phonegap folder'] = (test) -> +exports['default example project has a /cordova folder'] = (test) -> test.expect 1 - path.exists './example/phonegap', (exists) -> - test.ok exists, 'the other phonegap folder exists' + path.exists './example/cordova', (exists) -> + test.ok exists, 'the other cordova folder exists' test.done() diff --git a/framework/.project b/framework/.project index 16f5706a..56d67639 100644 --- a/framework/.project +++ b/framework/.project @@ -1,6 +1,6 @@ - PhoneGap + Cordova diff --git a/framework/AndroidManifest.xml b/framework/AndroidManifest.xml index c0cbc945..ca70fd09 100755 --- a/framework/AndroidManifest.xml +++ b/framework/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="org.apache.cordova" android:versionName="1.1" android:versionCode="5"> - diff --git a/framework/assets/js/accelerometer.js b/framework/assets/js/accelerometer.js index 7816c8b9..ce994c5a 100755 --- a/framework/assets/js/accelerometer.js +++ b/framework/assets/js/accelerometer.js @@ -17,8 +17,8 @@ * under the License. */ -if (!PhoneGap.hasResource("accelerometer")) { -PhoneGap.addResource("accelerometer"); +if (!Cordova.hasResource("accelerometer")) { +Cordova.addResource("accelerometer"); /** @constructor */ var Acceleration = function(x, y, z) { @@ -69,7 +69,7 @@ Accelerometer.prototype.getCurrentAcceleration = function(successCallback, error } // Get acceleration - PhoneGap.exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []); + Cordova.exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []); }; /** @@ -98,18 +98,18 @@ Accelerometer.prototype.watchAcceleration = function(successCallback, errorCallb } // Make sure accelerometer timeout > frequency + 10 sec - PhoneGap.exec( + Cordova.exec( function(timeout) { if (timeout < (frequency + 10000)) { - PhoneGap.exec(null, null, "Accelerometer", "setTimeout", [frequency + 10000]); + Cordova.exec(null, null, "Accelerometer", "setTimeout", [frequency + 10000]); } }, function(e) { }, "Accelerometer", "getTimeout", []); // Start watch timer - var id = PhoneGap.createUUID(); + var id = Cordova.createUUID(); navigator.accelerometer.timers[id] = setInterval(function() { - PhoneGap.exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []); + Cordova.exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []); }, (frequency ? frequency : 1)); return id; @@ -129,7 +129,7 @@ Accelerometer.prototype.clearWatch = function(id) { } }; -PhoneGap.addConstructor(function() { +Cordova.addConstructor(function() { if (typeof navigator.accelerometer === "undefined") { navigator.accelerometer = new Accelerometer(); } diff --git a/framework/assets/js/app.js b/framework/assets/js/app.js index 4eea08ef..2462c9af 100755 --- a/framework/assets/js/app.js +++ b/framework/assets/js/app.js @@ -17,8 +17,8 @@ * under the License. */ -if (!PhoneGap.hasResource("app")) { -PhoneGap.addResource("app"); +if (!Cordova.hasResource("app")) { +Cordova.addResource("app"); (function() { /** @@ -31,7 +31,7 @@ var App = function() {}; * Clear the resource cache. */ App.prototype.clearCache = function() { - PhoneGap.exec(null, null, "App", "clearCache", []); + Cordova.exec(null, null, "App", "clearCache", []); }; /** @@ -49,14 +49,14 @@ App.prototype.clearCache = function() { * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000}); */ App.prototype.loadUrl = function(url, props) { - PhoneGap.exec(null, null, "App", "loadUrl", [url, props]); + Cordova.exec(null, null, "App", "loadUrl", [url, props]); }; /** * Cancel loadUrl that is waiting to be loaded. */ App.prototype.cancelLoadUrl = function() { - PhoneGap.exec(null, null, "App", "cancelLoadUrl", []); + Cordova.exec(null, null, "App", "cancelLoadUrl", []); }; /** @@ -64,7 +64,7 @@ App.prototype.cancelLoadUrl = function() { * Instead of BACK button loading the previous web page, it will exit the app. */ App.prototype.clearHistory = function() { - PhoneGap.exec(null, null, "App", "clearHistory", []); + Cordova.exec(null, null, "App", "clearHistory", []); }; /** @@ -72,17 +72,17 @@ App.prototype.clearHistory = function() { * This is the same as pressing the backbutton on Android device. */ App.prototype.backHistory = function() { - PhoneGap.exec(null, null, "App", "backHistory", []); + Cordova.exec(null, null, "App", "backHistory", []); }; /** * Exit and terminate the application. */ App.prototype.exitApp = function() { - return PhoneGap.exec(null, null, "App", "exitApp", []); + return Cordova.exec(null, null, "App", "exitApp", []); }; -PhoneGap.addConstructor(function() { +Cordova.addConstructor(function() { navigator.app = new App(); }); }()); diff --git a/framework/assets/js/battery.js b/framework/assets/js/battery.js index 2723c49d..c603a8da 100755 --- a/framework/assets/js/battery.js +++ b/framework/assets/js/battery.js @@ -17,8 +17,8 @@ * under the License. */ -if (!PhoneGap.hasResource("battery")) { -PhoneGap.addResource("battery"); +if (!Cordova.hasResource("battery")) { +Cordova.addResource("battery"); /** * This class contains information about the current battery status. @@ -44,7 +44,7 @@ Battery.prototype.eventHandler = function(eventType, handler, add) { if (add) { // If there are no current registered event listeners start the battery listener on native side. if (me._batteryListener.length === 0 && me._lowListener.length === 0 && me._criticalListener.length === 0) { - PhoneGap.exec(me._status, me._error, "Battery", "start", []); + Cordova.exec(me._status, me._error, "Battery", "start", []); } // Register the event listener in the proper array @@ -83,7 +83,7 @@ Battery.prototype.eventHandler = function(eventType, handler, add) { // If there are no more registered event listeners stop the battery listener on native side. if (me._batteryListener.length === 0 && me._lowListener.length === 0 && me._criticalListener.length === 0) { - PhoneGap.exec(null, null, "Battery", "stop", []); + Cordova.exec(null, null, "Battery", "stop", []); } } }; @@ -99,15 +99,15 @@ Battery.prototype._status = function(info) { var level = info.level; if (me._level !== level || me._isPlugged !== info.isPlugged) { // Fire batterystatus event - PhoneGap.fireWindowEvent("batterystatus", info); + Cordova.fireWindowEvent("batterystatus", info); // Fire low battery event if (level === 20 || level === 5) { if (level === 20) { - PhoneGap.fireWindowEvent("batterylow", info); + Cordova.fireWindowEvent("batterylow", info); } else { - PhoneGap.fireWindowEvent("batterycritical", info); + Cordova.fireWindowEvent("batterycritical", info); } } } @@ -123,12 +123,12 @@ Battery.prototype._error = function(e) { console.log("Error initializing Battery: " + e); }; -PhoneGap.addConstructor(function() { +Cordova.addConstructor(function() { if (typeof navigator.battery === "undefined") { navigator.battery = new Battery(); - PhoneGap.addWindowEventHandler("batterystatus", navigator.battery.eventHandler); - PhoneGap.addWindowEventHandler("batterylow", navigator.battery.eventHandler); - PhoneGap.addWindowEventHandler("batterycritical", navigator.battery.eventHandler); + Cordova.addWindowEventHandler("batterystatus", navigator.battery.eventHandler); + Cordova.addWindowEventHandler("batterylow", navigator.battery.eventHandler); + Cordova.addWindowEventHandler("batterycritical", navigator.battery.eventHandler); } }); } diff --git a/framework/assets/js/camera.js b/framework/assets/js/camera.js index e1467c63..31f2b3dc 100755 --- a/framework/assets/js/camera.js +++ b/framework/assets/js/camera.js @@ -17,8 +17,8 @@ * under the License. */ -if (!PhoneGap.hasResource("camera")) { -PhoneGap.addResource("camera"); +if (!Cordova.hasResource("camera")) { +Cordova.addResource("camera"); /** * This class provides access to the device camera. @@ -157,10 +157,10 @@ Camera.prototype.getPicture = function(successCallback, errorCallback, options) } } - PhoneGap.exec(successCallback, errorCallback, "Camera", "takePicture", [options]); + Cordova.exec(successCallback, errorCallback, "Camera", "takePicture", [options]); }; -PhoneGap.addConstructor(function() { +Cordova.addConstructor(function() { if (typeof navigator.camera === "undefined") { navigator.camera = new Camera(); } diff --git a/framework/assets/js/capture.js b/framework/assets/js/capture.js index 28ad367f..ba441366 100644 --- a/framework/assets/js/capture.js +++ b/framework/assets/js/capture.js @@ -17,8 +17,8 @@ * under the License. */ -if (!PhoneGap.hasResource("capture")) { -PhoneGap.addResource("capture"); +if (!Cordova.hasResource("capture")) { +Cordova.addResource("capture"); /** * Represents a single file. @@ -44,7 +44,7 @@ var MediaFile = function(name, fullPath, type, lastModifiedDate, size){ * @param {Function} errorCB */ MediaFile.prototype.getFormatData = function(successCallback, errorCallback){ - PhoneGap.exec(successCallback, errorCallback, "Capture", "getFormatData", [this.fullPath, this.type]); + Cordova.exec(successCallback, errorCallback, "Capture", "getFormatData", [this.fullPath, this.type]); }; /** @@ -95,7 +95,7 @@ var Capture = function(){ * @param {CaptureAudioOptions} options */ Capture.prototype.captureAudio = function(successCallback, errorCallback, options){ - PhoneGap.exec(successCallback, errorCallback, "Capture", "captureAudio", [options]); + Cordova.exec(successCallback, errorCallback, "Capture", "captureAudio", [options]); }; /** @@ -106,7 +106,7 @@ Capture.prototype.captureAudio = function(successCallback, errorCallback, option * @param {CaptureImageOptions} options */ Capture.prototype.captureImage = function(successCallback, errorCallback, options){ - PhoneGap.exec(successCallback, errorCallback, "Capture", "captureImage", [options]); + Cordova.exec(successCallback, errorCallback, "Capture", "captureImage", [options]); }; /** @@ -140,7 +140,7 @@ Capture.prototype._castMediaFile = function(pluginResult){ * @param {CaptureVideoOptions} options */ Capture.prototype.captureVideo = function(successCallback, errorCallback, options){ - PhoneGap.exec(successCallback, errorCallback, "Capture", "captureVideo", [options]); + Cordova.exec(successCallback, errorCallback, "Capture", "captureVideo", [options]); }; /** @@ -191,7 +191,7 @@ var CaptureAudioOptions = function(){ this.mode = null; }; -PhoneGap.addConstructor(function(){ +Cordova.addConstructor(function(){ if (typeof navigator.device.capture === "undefined") { navigator.device.capture = window.device.capture = new Capture(); } diff --git a/framework/assets/js/compass.js b/framework/assets/js/compass.js index 64655169..b8c9e136 100755 --- a/framework/assets/js/compass.js +++ b/framework/assets/js/compass.js @@ -17,8 +17,8 @@ * under the License. */ -if (!PhoneGap.hasResource("compass")) { -PhoneGap.addResource("compass"); +if (!Cordova.hasResource("compass")) { +Cordova.addResource("compass"); var CompassError = function(){ this.code = null; @@ -75,7 +75,7 @@ Compass.prototype.getCurrentHeading = function(successCallback, errorCallback, o } // Get heading - PhoneGap.exec(successCallback, errorCallback, "Compass", "getHeading", []); + Cordova.exec(successCallback, errorCallback, "Compass", "getHeading", []); }; /** @@ -104,19 +104,19 @@ Compass.prototype.watchHeading= function(successCallback, errorCallback, options } // Make sure compass timeout > frequency + 10 sec - PhoneGap.exec( + Cordova.exec( function(timeout) { if (timeout < (frequency + 10000)) { - PhoneGap.exec(null, null, "Compass", "setTimeout", [frequency + 10000]); + Cordova.exec(null, null, "Compass", "setTimeout", [frequency + 10000]); } }, function(e) { }, "Compass", "getTimeout", []); // Start watch timer to get headings - var id = PhoneGap.createUUID(); + var id = Cordova.createUUID(); navigator.compass.timers[id] = setInterval( function() { - PhoneGap.exec(successCallback, errorCallback, "Compass", "getHeading", []); + Cordova.exec(successCallback, errorCallback, "Compass", "getHeading", []); }, (frequency ? frequency : 1)); return id; @@ -145,7 +145,7 @@ Compass.prototype._castDate = function(pluginResult) { return pluginResult; }; -PhoneGap.addConstructor(function() { +Cordova.addConstructor(function() { if (typeof navigator.compass === "undefined") { navigator.compass = new Compass(); } diff --git a/framework/assets/js/contact.js b/framework/assets/js/contact.js index 8d87811b..a4d78233 100755 --- a/framework/assets/js/contact.js +++ b/framework/assets/js/contact.js @@ -17,8 +17,8 @@ * under the License. */ -if (!PhoneGap.hasResource("contact")) { -PhoneGap.addResource("contact"); +if (!Cordova.hasResource("contact")) { +Cordova.addResource("contact"); /** * Contains information about a single contact. @@ -89,7 +89,7 @@ Contact.prototype.remove = function(successCB, errorCB) { errorCB(errorObj); } else { - PhoneGap.exec(successCB, errorCB, "Contacts", "remove", [this.id]); + Cordova.exec(successCB, errorCB, "Contacts", "remove", [this.id]); } }; @@ -99,7 +99,7 @@ Contact.prototype.remove = function(successCB, errorCB) { * @return copy of this Contact */ Contact.prototype.clone = function() { - var clonedContact = PhoneGap.clone(this); + var clonedContact = Cordova.clone(this); var i; clonedContact.id = null; clonedContact.rawId = null; @@ -153,7 +153,7 @@ Contact.prototype.clone = function() { * @param errorCB error callback */ Contact.prototype.save = function(successCB, errorCB) { - PhoneGap.exec(successCB, errorCB, "Contacts", "save", [this]); + Cordova.exec(successCB, errorCB, "Contacts", "save", [this]); }; /** @@ -259,7 +259,7 @@ Contacts.prototype.find = function(fields, successCB, errorCB, options) { errorCB({"code": ContactError.INVALID_ARGUMENT_ERROR}); } } else { - PhoneGap.exec(successCB, errorCB, "Contacts", "search", [fields, options]); + Cordova.exec(successCB, errorCB, "Contacts", "search", [fields, options]); } }; @@ -313,7 +313,7 @@ var ContactFindOptions = function(filter, multiple) { /** * Add the contact interface into the browser. */ -PhoneGap.addConstructor(function() { +Cordova.addConstructor(function() { if(typeof navigator.contacts === "undefined") { navigator.contacts = new Contacts(); } diff --git a/framework/assets/js/phonegap.js.base b/framework/assets/js/cordova.js.base similarity index 65% rename from framework/assets/js/phonegap.js.base rename to framework/assets/js/cordova.js.base index 2d7c383f..bb325804 100755 --- a/framework/assets/js/phonegap.js.base +++ b/framework/assets/js/cordova.js.base @@ -17,26 +17,24 @@ * under the License. */ -// Version 1.2.0 - -if (typeof PhoneGap === "undefined") { +if (typeof Cordova === "undefined") { /** - * The order of events during page load and PhoneGap startup is as follows: + * The order of events during page load and Cordova startup is as follows: * * onDOMContentLoaded Internal event that is received when the web page is loaded and parsed. * window.onload Body onload event. - * onNativeReady Internal event that indicates the PhoneGap native side is ready. - * onPhoneGapInit Internal event that kicks off creation of all PhoneGap JavaScript objects (runs constructors). - * onPhoneGapReady Internal event fired when all PhoneGap JavaScript objects have been created - * onPhoneGapInfoReady Internal event fired when device properties are available - * onDeviceReady User event fired to indicate that PhoneGap is ready + * onNativeReady Internal event that indicates the Cordova native side is ready. + * onCordovaInit Internal event that kicks off creation of all Cordova JavaScript objects (runs constructors). + * onCordovaReady Internal event fired when all Cordova JavaScript objects have been created + * onCordovaInfoReady Internal event fired when device properties are available + * onDeviceReady User event fired to indicate that Cordova is ready * onResume User event fired to indicate a start/resume lifecycle event * onPause User event fired to indicate a pause lifecycle event * onDestroy Internal event fired when app is being destroyed (User should use window.onunload event, not this one). * - * The only PhoneGap events that user code should register for are: - * deviceready PhoneGap native code is initialized and PhoneGap APIs can be called from JavaScript + * The only Cordova events that user code should register for are: + * deviceready Cordova native code is initialized and Cordova APIs can be called from JavaScript * pause App has moved to background * resume App has returned to foreground * @@ -51,45 +49,45 @@ if (typeof PhoneGap === "undefined") { */ /** - * This represents the PhoneGap API itself, and provides a global namespace for accessing - * information about the state of PhoneGap. + * This represents the Cordova API itself, and provides a global namespace for accessing + * information about the state of Cordova. * @class */ -var PhoneGap = { +var Cordova = { documentEventHandler: {}, // Collection of custom document event handlers windowEventHandler: {} // Collection of custom window event handlers }; /** - * List of resource files loaded by PhoneGap. + * List of resource files loaded by Cordova. * This is used to ensure JS and other files are loaded only once. */ -PhoneGap.resources = {base: true}; +Cordova.resources = {base: true}; /** - * Determine if resource has been loaded by PhoneGap + * Determine if resource has been loaded by Cordova * * @param name * @return */ -PhoneGap.hasResource = function(name) { - return PhoneGap.resources[name]; +Cordova.hasResource = function(name) { + return Cordova.resources[name]; }; /** - * Add a resource to list of loaded resources by PhoneGap + * Add a resource to list of loaded resources by Cordova * * @param name */ -PhoneGap.addResource = function(name) { - PhoneGap.resources[name] = true; +Cordova.addResource = function(name) { + Cordova.resources[name] = true; }; /** * Custom pub-sub channel that can have functions subscribed to it * @constructor */ -PhoneGap.Channel = function (type) +Cordova.Channel = function (type) { this.type = type; this.handlers = {}; @@ -105,12 +103,12 @@ PhoneGap.Channel = function (type) * and a guid that can be used to stop subscribing to the channel. * Returns the guid. */ -PhoneGap.Channel.prototype.subscribe = function(f, c, g) { +Cordova.Channel.prototype.subscribe = function(f, c, g) { // need a function to call if (f === null) { return; } var func = f; - if (typeof c === "object" && typeof f === "function") { func = PhoneGap.close(c, f); } + if (typeof c === "object" && typeof f === "function") { func = Cordova.close(c, f); } g = g || func.observer_guid || f.observer_guid || this.guid++; func.observer_guid = g; @@ -123,7 +121,7 @@ PhoneGap.Channel.prototype.subscribe = function(f, c, g) { * Like subscribe but the function is only called once and then it * auto-unsubscribes itself. */ -PhoneGap.Channel.prototype.subscribeOnce = function(f, c) { +Cordova.Channel.prototype.subscribeOnce = function(f, c) { var g = null; var _this = this; var m = function() { @@ -131,7 +129,7 @@ PhoneGap.Channel.prototype.subscribeOnce = function(f, c) { _this.unsubscribe(g); }; if (this.fired) { - if (typeof c === "object" && typeof f === "function") { f = PhoneGap.close(c, f); } + if (typeof c === "object" && typeof f === "function") { f = Cordova.close(c, f); } f.apply(this, this.fireArgs); } else { g = this.subscribe(m); @@ -142,7 +140,7 @@ PhoneGap.Channel.prototype.subscribeOnce = function(f, c) { /** * Unsubscribes the function with the given guid from the channel. */ -PhoneGap.Channel.prototype.unsubscribe = function(g) { +Cordova.Channel.prototype.unsubscribe = function(g) { if (typeof g === "function") { g = g.observer_guid; } this.handlers[g] = null; delete this.handlers[g]; @@ -151,7 +149,7 @@ PhoneGap.Channel.prototype.unsubscribe = function(g) { /** * Calls all functions subscribed to this channel. */ -PhoneGap.Channel.prototype.fire = function(e) { +Cordova.Channel.prototype.fire = function(e) { if (this.enabled) { var fail = false; var item, handler, rv; @@ -175,7 +173,7 @@ PhoneGap.Channel.prototype.fire = function(e) { * Calls the provided function only after all of the channels specified * have been fired. */ -PhoneGap.Channel.join = function(h, c) { +Cordova.Channel.join = function(h, c) { var i = c.length; var f = function() { if (!(--i)) { @@ -199,11 +197,11 @@ PhoneGap.Channel.join = function(h, c) { /** * Add an initialization function to a queue that ensures it will run and initialize - * application constructors only once PhoneGap has been initialized. - * @param {Function} func The function callback you want run once PhoneGap is initialized + * application constructors only once Cordova has been initialized. + * @param {Function} func The function callback you want run once Cordova is initialized */ -PhoneGap.addConstructor = function(func) { - PhoneGap.onPhoneGapInit.subscribeOnce(function() { +Cordova.addConstructor = function(func) { + Cordova.onCordovaInit.subscribeOnce(function() { try { func(); } catch(e) { @@ -226,7 +224,7 @@ if (!window.plugins) { * @param name The plugin name * @param obj The plugin object */ -PhoneGap.addPlugin = function(name, obj) { +Cordova.addPlugin = function(name, obj) { if (!window.plugins[name]) { window.plugins[name] = obj; } @@ -239,78 +237,78 @@ PhoneGap.addPlugin = function(name, obj) { * onDOMContentLoaded channel is fired when the DOM content * of the page has been parsed. */ -PhoneGap.onDOMContentLoaded = new PhoneGap.Channel('onDOMContentLoaded'); +Cordova.onDOMContentLoaded = new Cordova.Channel('onDOMContentLoaded'); /** - * onNativeReady channel is fired when the PhoneGap native code + * onNativeReady channel is fired when the Cordova native code * has been initialized. */ -PhoneGap.onNativeReady = new PhoneGap.Channel('onNativeReady'); +Cordova.onNativeReady = new Cordova.Channel('onNativeReady'); /** - * onPhoneGapInit channel is fired when the web page is fully loaded and - * PhoneGap native code has been initialized. + * onCordovaInit channel is fired when the web page is fully loaded and + * Cordova native code has been initialized. */ -PhoneGap.onPhoneGapInit = new PhoneGap.Channel('onPhoneGapInit'); +Cordova.onCordovaInit = new Cordova.Channel('onCordovaInit'); /** - * onPhoneGapReady channel is fired when the JS PhoneGap objects have been created. + * onCordovaReady channel is fired when the JS Cordova objects have been created. */ -PhoneGap.onPhoneGapReady = new PhoneGap.Channel('onPhoneGapReady'); +Cordova.onCordovaReady = new Cordova.Channel('onCordovaReady'); /** - * onPhoneGapInfoReady channel is fired when the PhoneGap device properties + * onCordovaInfoReady channel is fired when the Cordova device properties * has been set. */ -PhoneGap.onPhoneGapInfoReady = new PhoneGap.Channel('onPhoneGapInfoReady'); +Cordova.onCordovaInfoReady = new Cordova.Channel('onCordovaInfoReady'); /** - * onPhoneGapConnectionReady channel is fired when the PhoneGap connection properties + * onCordovaConnectionReady channel is fired when the Cordova connection properties * has been set. */ -PhoneGap.onPhoneGapConnectionReady = new PhoneGap.Channel('onPhoneGapConnectionReady'); +Cordova.onCordovaConnectionReady = new Cordova.Channel('onCordovaConnectionReady'); /** - * onDestroy channel is fired when the PhoneGap native code + * onDestroy channel is fired when the Cordova native code * is destroyed. It is used internally. * Window.onunload should be used by the user. */ -PhoneGap.onDestroy = new PhoneGap.Channel('onDestroy'); -PhoneGap.onDestroy.subscribeOnce(function() { - PhoneGap.shuttingDown = true; +Cordova.onDestroy = new Cordova.Channel('onDestroy'); +Cordova.onDestroy.subscribeOnce(function() { + Cordova.shuttingDown = true; }); -PhoneGap.shuttingDown = false; +Cordova.shuttingDown = false; // _nativeReady is global variable that the native side can set // to signify that the native code is ready. It is a global since -// it may be called before any PhoneGap JS is ready. -if (typeof _nativeReady !== 'undefined') { PhoneGap.onNativeReady.fire(); } +// it may be called before any Cordova JS is ready. +if (typeof _nativeReady !== 'undefined') { Cordova.onNativeReady.fire(); } /** - * onDeviceReady is fired only after all PhoneGap objects are created and + * onDeviceReady is fired only after all Cordova objects are created and * the device properties are set. */ -PhoneGap.onDeviceReady = new PhoneGap.Channel('onDeviceReady'); +Cordova.onDeviceReady = new Cordova.Channel('onDeviceReady'); // Array of channels that must fire before "deviceready" is fired -PhoneGap.deviceReadyChannelsArray = [ PhoneGap.onPhoneGapReady, PhoneGap.onPhoneGapInfoReady, PhoneGap.onPhoneGapConnectionReady]; +Cordova.deviceReadyChannelsArray = [ Cordova.onCordovaReady, Cordova.onCordovaInfoReady, Cordova.onCordovaConnectionReady]; // Hashtable of user defined channels that must also fire before "deviceready" is fired -PhoneGap.deviceReadyChannelsMap = {}; +Cordova.deviceReadyChannelsMap = {}; /** * Indicate that a feature needs to be initialized before it is ready to be used. - * This holds up PhoneGap's "deviceready" event until the feature has been initialized - * and PhoneGap.initComplete(feature) is called. + * This holds up Cordova's "deviceready" event until the feature has been initialized + * and Cordova.initComplete(feature) is called. * * @param feature {String} The unique feature name */ -PhoneGap.waitForInitialization = function(feature) { +Cordova.waitForInitialization = function(feature) { if (feature) { - var channel = new PhoneGap.Channel(feature); - PhoneGap.deviceReadyChannelsMap[feature] = channel; - PhoneGap.deviceReadyChannelsArray.push(channel); + var channel = new Cordova.Channel(feature); + Cordova.deviceReadyChannelsMap[feature] = channel; + Cordova.deviceReadyChannelsArray.push(channel); } }; @@ -319,64 +317,64 @@ PhoneGap.waitForInitialization = function(feature) { * * @param feature {String} The unique feature name */ -PhoneGap.initializationComplete = function(feature) { - var channel = PhoneGap.deviceReadyChannelsMap[feature]; +Cordova.initializationComplete = function(feature) { + var channel = Cordova.deviceReadyChannelsMap[feature]; if (channel) { channel.fire(); } }; /** - * Create all PhoneGap objects once page has fully loaded and native side is ready. + * Create all Cordova objects once page has fully loaded and native side is ready. */ -PhoneGap.Channel.join(function() { +Cordova.Channel.join(function() { // Start listening for XHR callbacks setTimeout(function() { - if (PhoneGap.UsePolling) { - PhoneGap.JSCallbackPolling(); + if (Cordova.UsePolling) { + Cordova.JSCallbackPolling(); } else { var polling = prompt("usePolling", "gap_callbackServer:"); - PhoneGap.UsePolling = polling; + Cordova.UsePolling = polling; if (polling == "true") { - PhoneGap.UsePolling = true; - PhoneGap.JSCallbackPolling(); + Cordova.UsePolling = true; + Cordova.JSCallbackPolling(); } else { - PhoneGap.UsePolling = false; - PhoneGap.JSCallback(); + Cordova.UsePolling = false; + Cordova.JSCallback(); } } }, 1); - // Run PhoneGap constructors - PhoneGap.onPhoneGapInit.fire(); + // Run Cordova constructors + Cordova.onCordovaInit.fire(); // Fire event to notify that all objects are created - PhoneGap.onPhoneGapReady.fire(); + Cordova.onCordovaReady.fire(); - // Fire onDeviceReady event once all constructors have run and PhoneGap info has been + // Fire onDeviceReady event once all constructors have run and Cordova info has been // received from native side, and any user defined initialization channels. - PhoneGap.Channel.join(function() { + Cordova.Channel.join(function() { // Let native code know we are inited on JS side prompt("", "gap_init:"); - PhoneGap.onDeviceReady.fire(); - }, PhoneGap.deviceReadyChannelsArray); + Cordova.onDeviceReady.fire(); + }, Cordova.deviceReadyChannelsArray); -}, [ PhoneGap.onDOMContentLoaded, PhoneGap.onNativeReady ]); +}, [ Cordova.onDOMContentLoaded, Cordova.onNativeReady ]); // Listen for DOMContentLoaded and notify our channel subscribers document.addEventListener('DOMContentLoaded', function() { - PhoneGap.onDOMContentLoaded.fire(); + Cordova.onDOMContentLoaded.fire(); }, false); // Intercept calls to document.addEventListener and watch for deviceready -PhoneGap.m_document_addEventListener = document.addEventListener; +Cordova.m_document_addEventListener = document.addEventListener; // Intercept calls to window.addEventListener -PhoneGap.m_window_addEventListener = window.addEventListener; +Cordova.m_window_addEventListener = window.addEventListener; /** * Add a custom window event handler. @@ -384,8 +382,8 @@ PhoneGap.m_window_addEventListener = window.addEventListener; * @param {String} event The event name that callback handles * @param {Function} callback The event handler */ -PhoneGap.addWindowEventHandler = function(event, callback) { - PhoneGap.windowEventHandler[event] = callback; +Cordova.addWindowEventHandler = function(event, callback) { + Cordova.windowEventHandler[event] = callback; }; /** @@ -394,8 +392,8 @@ PhoneGap.addWindowEventHandler = function(event, callback) { * @param {String} event The event name that callback handles * @param {Function} callback The event handler */ -PhoneGap.addDocumentEventHandler = function(event, callback) { - PhoneGap.documentEventHandler[event] = callback; +Cordova.addDocumentEventHandler = function(event, callback) { + Cordova.documentEventHandler[event] = callback; }; /** @@ -408,22 +406,22 @@ PhoneGap.addDocumentEventHandler = function(event, callback) { document.addEventListener = function(evt, handler, capture) { var e = evt.toLowerCase(); if (e === 'deviceready') { - PhoneGap.onDeviceReady.subscribeOnce(handler); + Cordova.onDeviceReady.subscribeOnce(handler); } else { // If subscribing to Android backbutton if (e === 'backbutton') { - PhoneGap.exec(null, null, "App", "overrideBackbutton", [true]); + Cordova.exec(null, null, "App", "overrideBackbutton", [true]); } // If subscribing to an event that is handled by a plugin - else if (typeof PhoneGap.documentEventHandler[e] !== "undefined") { - if (PhoneGap.documentEventHandler[e](e, handler, true)) { + else if (typeof Cordova.documentEventHandler[e] !== "undefined") { + if (Cordova.documentEventHandler[e](e, handler, true)) { return; // Stop default behavior } } - PhoneGap.m_document_addEventListener.call(document, evt, handler, capture); + Cordova.m_document_addEventListener.call(document, evt, handler, capture); } }; @@ -438,21 +436,21 @@ window.addEventListener = function(evt, handler, capture) { var e = evt.toLowerCase(); // If subscribing to an event that is handled by a plugin - if (typeof PhoneGap.windowEventHandler[e] !== "undefined") { - if (PhoneGap.windowEventHandler[e](e, handler, true)) { + if (typeof Cordova.windowEventHandler[e] !== "undefined") { + if (Cordova.windowEventHandler[e](e, handler, true)) { return; // Stop default behavior } } - PhoneGap.m_window_addEventListener.call(window, evt, handler, capture); + Cordova.m_window_addEventListener.call(window, evt, handler, capture); }; // Intercept calls to document.removeEventListener and watch for events that -// are generated by PhoneGap native code -PhoneGap.m_document_removeEventListener = document.removeEventListener; +// are generated by Cordova native code +Cordova.m_document_removeEventListener = document.removeEventListener; // Intercept calls to window.removeEventListener -PhoneGap.m_window_removeEventListener = window.removeEventListener; +Cordova.m_window_removeEventListener = window.removeEventListener; /** * Intercept removing document event listeners and handle our own @@ -466,17 +464,17 @@ document.removeEventListener = function(evt, handler, capture) { // If unsubscribing to Android backbutton if (e === 'backbutton') { - PhoneGap.exec(null, null, "App", "overrideBackbutton", [false]); + Cordova.exec(null, null, "App", "overrideBackbutton", [false]); } // If unsubcribing from an event that is handled by a plugin - if (typeof PhoneGap.documentEventHandler[e] !== "undefined") { - if (PhoneGap.documentEventHandler[e](e, handler, false)) { + if (typeof Cordova.documentEventHandler[e] !== "undefined") { + if (Cordova.documentEventHandler[e](e, handler, false)) { return; // Stop default behavior } } - PhoneGap.m_document_removeEventListener.call(document, evt, handler, capture); + Cordova.m_document_removeEventListener.call(document, evt, handler, capture); }; /** @@ -490,13 +488,13 @@ window.removeEventListener = function(evt, handler, capture) { var e = evt.toLowerCase(); // If unsubcribing from an event that is handled by a plugin - if (typeof PhoneGap.windowEventHandler[e] !== "undefined") { - if (PhoneGap.windowEventHandler[e](e, handler, false)) { + if (typeof Cordova.windowEventHandler[e] !== "undefined") { + if (Cordova.windowEventHandler[e](e, handler, false)) { return; // Stop default behavior } } - PhoneGap.m_window_removeEventListener.call(window, evt, handler, capture); + Cordova.m_window_removeEventListener.call(window, evt, handler, capture); }; /** @@ -505,7 +503,7 @@ window.removeEventListener = function(evt, handler, capture) { * @param {String} type The event type to fire * @param {Object} data Data to send with event */ -PhoneGap.fireDocumentEvent = function(type, data) { +Cordova.fireDocumentEvent = function(type, data) { var e = document.createEvent('Events'); e.initEvent(type); if (data) { @@ -522,7 +520,7 @@ PhoneGap.fireDocumentEvent = function(type, data) { * @param {String} type The event type to fire * @param {Object} data Data to send with event */ -PhoneGap.fireWindowEvent = function(type, data) { +Cordova.fireWindowEvent = function(type, data) { var e = document.createEvent('Events'); e.initEvent(type); if (data) { @@ -539,7 +537,7 @@ PhoneGap.fireWindowEvent = function(type, data) { * @param obj * @return {Object} */ -PhoneGap.clone = function(obj) { +Cordova.clone = function(obj) { var i, retVal; if(!obj) { return obj; @@ -548,7 +546,7 @@ PhoneGap.clone = function(obj) { if(obj instanceof Array){ retVal = []; for(i = 0; i < obj.length; ++i){ - retVal.push(PhoneGap.clone(obj[i])); + retVal.push(Cordova.clone(obj[i])); } return retVal; } @@ -568,15 +566,15 @@ PhoneGap.clone = function(obj) { retVal = {}; for(i in obj){ if(!(i in retVal) || retVal[i] !== obj[i]) { - retVal[i] = PhoneGap.clone(obj[i]); + retVal[i] = Cordova.clone(obj[i]); } } return retVal; }; -PhoneGap.callbackId = 0; -PhoneGap.callbacks = {}; -PhoneGap.callbackStatus = { +Cordova.callbackId = 0; +Cordova.callbacks = {}; +Cordova.callbackStatus = { NO_RESULT: 0, OK: 1, CLASS_NOT_FOUND_EXCEPTION: 2, @@ -591,24 +589,24 @@ PhoneGap.callbackStatus = { /** - * Execute a PhoneGap command. It is up to the native side whether this action is synch or async. + * Execute a Cordova command. It is up to the native side whether this action is synch or async. * The native side can return: * Synchronous: PluginResult object as a JSON string * Asynchrounous: Empty string "" - * If async, the native side will PhoneGap.callbackSuccess or PhoneGap.callbackError, + * If async, the native side will Cordova.callbackSuccess or Cordova.callbackError, * depending upon the result of the action. * * @param {Function} success The success callback * @param {Function} fail The fail callback * @param {String} service The name of the service to use - * @param {String} action Action to be run in PhoneGap + * @param {String} action Action to be run in Cordova * @param {Array.} [args] Zero or more arguments to pass to the method */ -PhoneGap.exec = function(success, fail, service, action, args) { +Cordova.exec = function(success, fail, service, action, args) { try { - var callbackId = service + PhoneGap.callbackId++; + var callbackId = service + Cordova.callbackId++; if (success || fail) { - PhoneGap.callbacks[callbackId] = {success:success, fail:fail}; + Cordova.callbacks[callbackId] = {success:success, fail:fail}; } var r = prompt(JSON.stringify(args), "gap:"+JSON.stringify([service, action, callbackId, true])); @@ -618,7 +616,7 @@ PhoneGap.exec = function(success, fail, service, action, args) { eval("var v="+r+";"); // If status is OK, then return value back to caller - if (v.status === PhoneGap.callbackStatus.OK) { + if (v.status === Cordova.callbackStatus.OK) { // If there is a success callback, then call it now with // returned value @@ -631,18 +629,18 @@ PhoneGap.exec = function(success, fail, service, action, args) { // Clear callback if not expecting any more results if (!v.keepCallback) { - delete PhoneGap.callbacks[callbackId]; + delete Cordova.callbacks[callbackId]; } } return v.message; } // If no result - else if (v.status === PhoneGap.callbackStatus.NO_RESULT) { + else if (v.status === Cordova.callbackStatus.NO_RESULT) { // Clear callback if not expecting any more results if (!v.keepCallback) { - delete PhoneGap.callbacks[callbackId]; + delete Cordova.callbacks[callbackId]; } } @@ -661,7 +659,7 @@ PhoneGap.exec = function(success, fail, service, action, args) { // Clear callback if not expecting any more results if (!v.keepCallback) { - delete PhoneGap.callbacks[callbackId]; + delete Cordova.callbacks[callbackId]; } } return null; @@ -678,14 +676,14 @@ PhoneGap.exec = function(success, fail, service, action, args) { * @param callbackId * @param args */ -PhoneGap.callbackSuccess = function(callbackId, args) { - if (PhoneGap.callbacks[callbackId]) { +Cordova.callbackSuccess = function(callbackId, args) { + if (Cordova.callbacks[callbackId]) { // If result is to be sent to callback - if (args.status === PhoneGap.callbackStatus.OK) { + if (args.status === Cordova.callbackStatus.OK) { try { - if (PhoneGap.callbacks[callbackId].success) { - PhoneGap.callbacks[callbackId].success(args.message); + if (Cordova.callbacks[callbackId].success) { + Cordova.callbacks[callbackId].success(args.message); } } catch (e) { @@ -695,7 +693,7 @@ PhoneGap.callbackSuccess = function(callbackId, args) { // Clear callback if not expecting any more results if (!args.keepCallback) { - delete PhoneGap.callbacks[callbackId]; + delete Cordova.callbacks[callbackId]; } } }; @@ -706,11 +704,11 @@ PhoneGap.callbackSuccess = function(callbackId, args) { * @param callbackId * @param args */ -PhoneGap.callbackError = function(callbackId, args) { - if (PhoneGap.callbacks[callbackId]) { +Cordova.callbackError = function(callbackId, args) { + if (Cordova.callbacks[callbackId]) { try { - if (PhoneGap.callbacks[callbackId].fail) { - PhoneGap.callbacks[callbackId].fail(args.message); + if (Cordova.callbacks[callbackId].fail) { + Cordova.callbacks[callbackId].fail(args.message); } } catch (e) { @@ -719,31 +717,31 @@ PhoneGap.callbackError = function(callbackId, args) { // Clear callback if not expecting any more results if (!args.keepCallback) { - delete PhoneGap.callbacks[callbackId]; + delete Cordova.callbacks[callbackId]; } } }; -PhoneGap.JSCallbackPort = null; -PhoneGap.JSCallbackToken = null; +Cordova.JSCallbackPort = null; +Cordova.JSCallbackToken = null; /** * This is only for Android. * - * Internal function that uses XHR to call into PhoneGap Java code and retrieve + * Internal function that uses XHR to call into Cordova Java code and retrieve * any JavaScript code that needs to be run. This is used for callbacks from * Java to JavaScript. */ -PhoneGap.JSCallback = function() { +Cordova.JSCallback = function() { // Exit if shutting down app - if (PhoneGap.shuttingDown) { + if (Cordova.shuttingDown) { return; } // If polling flag was changed, start using polling from now on - if (PhoneGap.UsePolling) { - PhoneGap.JSCallbackPolling(); + if (Cordova.UsePolling) { + Cordova.JSCallbackPolling(); return; } @@ -754,7 +752,7 @@ PhoneGap.JSCallback = function() { if(xmlhttp.readyState === 4){ // Exit if shutting down app - if (PhoneGap.shuttingDown) { + if (Cordova.shuttingDown) { return; } @@ -773,12 +771,12 @@ PhoneGap.JSCallback = function() { console.log("JSCallback Error: "+e); } }, 1); - setTimeout(PhoneGap.JSCallback, 1); + setTimeout(Cordova.JSCallback, 1); } // If callback ping (used to keep XHR request from timing out) else if (xmlhttp.status === 404) { - setTimeout(PhoneGap.JSCallback, 10); + setTimeout(Cordova.JSCallback, 10); } // If security error @@ -799,19 +797,19 @@ PhoneGap.JSCallback = function() { // If error, revert to polling else { console.log("JSCallback Error: Request failed."); - PhoneGap.UsePolling = true; - PhoneGap.JSCallbackPolling(); + Cordova.UsePolling = true; + Cordova.JSCallbackPolling(); } } }; - if (PhoneGap.JSCallbackPort === null) { - PhoneGap.JSCallbackPort = prompt("getPort", "gap_callbackServer:"); + if (Cordova.JSCallbackPort === null) { + Cordova.JSCallbackPort = prompt("getPort", "gap_callbackServer:"); } - if (PhoneGap.JSCallbackToken === null) { - PhoneGap.JSCallbackToken = prompt("getToken", "gap_callbackServer:"); + if (Cordova.JSCallbackToken === null) { + Cordova.JSCallbackToken = prompt("getToken", "gap_callbackServer:"); } - xmlhttp.open("GET", "http://127.0.0.1:"+PhoneGap.JSCallbackPort+"/"+PhoneGap.JSCallbackToken , true); + xmlhttp.open("GET", "http://127.0.0.1:"+Cordova.JSCallbackPort+"/"+Cordova.JSCallbackToken , true); xmlhttp.send(); }; @@ -819,30 +817,30 @@ PhoneGap.JSCallback = function() { * The polling period to use with JSCallbackPolling. * This can be changed by the application. The default is 50ms. */ -PhoneGap.JSCallbackPollingPeriod = 50; +Cordova.JSCallbackPollingPeriod = 50; /** * Flag that can be set by the user to force polling to be used or force XHR to be used. */ -PhoneGap.UsePolling = false; // T=use polling, F=use XHR +Cordova.UsePolling = false; // T=use polling, F=use XHR /** * This is only for Android. * - * Internal function that uses polling to call into PhoneGap Java code and retrieve + * Internal function that uses polling to call into Cordova Java code and retrieve * any JavaScript code that needs to be run. This is used for callbacks from * Java to JavaScript. */ -PhoneGap.JSCallbackPolling = function() { +Cordova.JSCallbackPolling = function() { // Exit if shutting down app - if (PhoneGap.shuttingDown) { + if (Cordova.shuttingDown) { return; } // If polling flag was changed, stop using polling from now on - if (!PhoneGap.UsePolling) { - PhoneGap.JSCallback(); + if (!Cordova.UsePolling) { + Cordova.JSCallback(); return; } @@ -857,10 +855,10 @@ PhoneGap.JSCallbackPolling = function() { console.log("JSCallbackPolling Error: "+e); } }, 1); - setTimeout(PhoneGap.JSCallbackPolling, 1); + setTimeout(Cordova.JSCallbackPolling, 1); } else { - setTimeout(PhoneGap.JSCallbackPolling, PhoneGap.JSCallbackPollingPeriod); + setTimeout(Cordova.JSCallbackPolling, Cordova.JSCallbackPollingPeriod); } }; @@ -869,15 +867,15 @@ PhoneGap.JSCallbackPolling = function() { * * @return {String} */ -PhoneGap.createUUID = function() { - return PhoneGap.UUIDcreatePart(4) + '-' + - PhoneGap.UUIDcreatePart(2) + '-' + - PhoneGap.UUIDcreatePart(2) + '-' + - PhoneGap.UUIDcreatePart(2) + '-' + - PhoneGap.UUIDcreatePart(6); +Cordova.createUUID = function() { + return Cordova.UUIDcreatePart(4) + '-' + + Cordova.UUIDcreatePart(2) + '-' + + Cordova.UUIDcreatePart(2) + '-' + + Cordova.UUIDcreatePart(2) + '-' + + Cordova.UUIDcreatePart(6); }; -PhoneGap.UUIDcreatePart = function(length) { +Cordova.UUIDcreatePart = function(length) { var uuidpart = ""; var i, uuidchar; for (i=0; i - + diff --git a/framework/build.xml b/framework/build.xml index 3e1da1d6..95c4915a 100644 --- a/framework/build.xml +++ b/framework/build.xml @@ -1,5 +1,5 @@ - + @@ -95,12 +95,12 @@ var alert=function(){},device={},Element={},debug={}; - + - + @@ -111,57 +111,57 @@ - + - + - + - + - - - + + + - - + + - - + + - + - - + - + - + - + @@ -184,10 +184,10 @@ - + - + diff --git a/framework/res/values/strings.xml b/framework/res/values/strings.xml index a58effa8..50389930 100644 --- a/framework/res/values/strings.xml +++ b/framework/res/values/strings.xml @@ -1,5 +1,5 @@ - PhoneGap + Cordova Snap diff --git a/framework/res/xml/phonegap.xml b/framework/res/xml/cordova.xml similarity index 96% rename from framework/res/xml/phonegap.xml rename to framework/res/xml/cordova.xml index 29476c2c..c387985a 100644 --- a/framework/res/xml/phonegap.xml +++ b/framework/res/xml/cordova.xml @@ -1,5 +1,5 @@ - +