mobile_template 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +28 -0
- data/Rakefile +3 -0
- data/bin/mobile_template +71 -0
- data/lib/mobile_template/version.rb +4 -0
- data/lib/mobile_template.rb +5 -0
- data/mobile_template.gemspec +21 -0
- data/templates/assets/Gemfile +4 -0
- data/templates/assets/config.rb +96 -0
- data/templates/assets/config.ru +4 -0
- data/templates/assets/source/images/vendor/ajax-loader.gif +0 -0
- data/templates/assets/source/images/vendor/ajax-loader.png +0 -0
- data/templates/assets/source/images/vendor/icons-18-black.png +0 -0
- data/templates/assets/source/images/vendor/icons-18-white.png +0 -0
- data/templates/assets/source/images/vendor/icons-36-black.png +0 -0
- data/templates/assets/source/images/vendor/icons-36-white.png +0 -0
- data/templates/assets/source/index.html.erb +2 -0
- data/templates/assets/source/javascripts/app/index.js.coffee +2 -0
- data/templates/assets/source/javascripts/application.js.coffee +5 -0
- data/templates/assets/source/javascripts/vendor/cordova.js +4841 -0
- data/templates/assets/source/javascripts/vendor/jquery.js +9267 -0
- data/templates/assets/source/javascripts/vendor/jquery.mobile.js +7410 -0
- data/templates/assets/source/layout.erb +24 -0
- data/templates/assets/source/stylesheets/application.css.scss +2 -0
- data/templates/assets/source/stylesheets/vendor/jquery.mobile.css.scss +1872 -0
- data/templates/cordova_android/.gitignore +18 -0
- data/templates/cordova_android/LICENSE +202 -0
- data/templates/cordova_android/NOTICE +5 -0
- data/templates/cordova_android/README.md +95 -0
- data/templates/cordova_android/VERSION +1 -0
- data/templates/cordova_android/bin/BOOM +4 -0
- data/templates/cordova_android/bin/autotest +2 -0
- data/templates/cordova_android/bin/bench +29 -0
- data/templates/cordova_android/bin/create +46 -0
- data/templates/cordova_android/bin/create.bat +1 -0
- data/templates/cordova_android/bin/create.js +88 -0
- data/templates/cordova_android/bin/create.xml +79 -0
- data/templates/cordova_android/bin/node_modules/.bin/cake +7 -0
- data/templates/cordova_android/bin/node_modules/.bin/coffee +7 -0
- data/templates/cordova_android/bin/node_modules/.bin/nodeunit +120 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/.npmignore +11 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/LICENSE +22 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/README +48 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/Rakefile +78 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/bin/cake +7 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/bin/coffee +7 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/extras/jsl.conf +44 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/browser.js +75 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/cake.js +76 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/coffee-script.js +135 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/command.js +301 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/grammar.js +591 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/helpers.js +66 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/index.js +8 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/lexer.js +656 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/nodes.js +2289 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/optparse.js +111 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/parser.js +676 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/repl.js +123 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/rewriter.js +363 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/lib/scope.js +120 -0
- data/templates/cordova_android/bin/node_modules/coffee-script/package.json +27 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/.gitignore +5 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/.npmignore +3 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/CONTRIBUTORS.md +60 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/LICENSE +19 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/Makefile +126 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/README.md +432 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/bin/nodeunit +120 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/bin/nodeunit.json +10 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/deps/async.js +623 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/deps/console.log.js +55 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/deps/ejs.js +125 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/deps/json2.js +483 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/examples/browser/nodeunit.js +1757 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/examples/browser/suite1.js +12 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/examples/browser/suite2.js +13 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/examples/browser/test.html +16 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/img/example_fail.png +0 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/img/example_pass.png +0 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/index.js +3 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/assert.js +316 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/core.js +260 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/nodeunit.js +82 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/browser.js +119 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/default.js +123 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/html.js +107 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/index.js +9 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/junit.js +183 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/minimal.js +112 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/skip_passed.js +105 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/track.js +48 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/types.js +187 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/lib/utils.js +209 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/man1/nodeunit.1 +95 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/nodelint.cfg +4 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/package.json +56 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/share/junit.xml.ejs +19 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/share/license.js +11 -0
- data/templates/cordova_android/bin/node_modules/nodeunit/share/nodeunit.css +70 -0
- data/templates/cordova_android/bin/templates/project/.cordova/android/readme.md +1 -0
- data/templates/cordova_android/bin/templates/project/.cordova/readme.md +3 -0
- data/templates/cordova_android/bin/templates/project/cordova/create +36 -0
- data/templates/cordova_android/bin/templates/project/cordova/debug +9 -0
- data/templates/cordova_android/bin/templates/project/cordova/emulate +12 -0
- data/templates/cordova_android/bin/templates/project/cordova/log +3 -0
- data/templates/cordova_android/bin/templates/project/cordova/templates/Activity.java +16 -0
- data/templates/cordova_android/bin/templates/project/cordova/templates/project/AndroidManifest.xml +50 -0
- data/templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/index.html +42 -0
- data/templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/main.js +146 -0
- data/templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/master.css +96 -0
- data/templates/cordova_android/bin/templates/project/cordova/templates/project/res/drawable/icon.png +0 -0
- data/templates/cordova_android/bin/templates/project/cordova/templates/project/res/xml/cordova.xml +5 -0
- data/templates/cordova_android/bin/templates/project/cordova/templates/project/res/xml/plugins.xml +19 -0
- data/templates/cordova_android/bin/test +26 -0
- data/templates/cordova_android/bin/tests/autotest.coffee +4 -0
- data/templates/cordova_android/bin/tests/create.coffee +21 -0
- data/templates/cordova_android/bin/tests/debug.coffee +0 -0
- data/templates/cordova_android/bin/tests/test.coffee +0 -0
- data/templates/cordova_android/framework/.classpath +8 -0
- data/templates/cordova_android/framework/.project +33 -0
- data/templates/cordova_android/framework/AndroidManifest.xml +68 -0
- data/templates/cordova_android/framework/ant.properties +34 -0
- data/templates/cordova_android/framework/assets/js/accelerometer.js +137 -0
- data/templates/cordova_android/framework/assets/js/app.js +89 -0
- data/templates/cordova_android/framework/assets/js/battery.js +134 -0
- data/templates/cordova_android/framework/assets/js/camera.js +168 -0
- data/templates/cordova_android/framework/assets/js/capture.js +203 -0
- data/templates/cordova_android/framework/assets/js/compass.js +168 -0
- data/templates/cordova_android/framework/assets/js/contact.js +310 -0
- data/templates/cordova_android/framework/assets/js/cordova.android.js +4841 -0
- data/templates/cordova_android/framework/assets/js/cordova.js.base +924 -0
- data/templates/cordova_android/framework/assets/js/crypto.js +54 -0
- data/templates/cordova_android/framework/assets/js/device.js +83 -0
- data/templates/cordova_android/framework/assets/js/file.js +1082 -0
- data/templates/cordova_android/framework/assets/js/filetransfer.js +125 -0
- data/templates/cordova_android/framework/assets/js/geolocation.js +209 -0
- data/templates/cordova_android/framework/assets/js/header.txt +19 -0
- data/templates/cordova_android/framework/assets/js/media.js +233 -0
- data/templates/cordova_android/framework/assets/js/network.js +100 -0
- data/templates/cordova_android/framework/assets/js/notification.js +133 -0
- data/templates/cordova_android/framework/assets/js/position.js +100 -0
- data/templates/cordova_android/framework/assets/js/storage.js +439 -0
- data/templates/cordova_android/framework/assets/www/index.html +27 -0
- data/templates/cordova_android/framework/build.xml +216 -0
- data/templates/cordova_android/framework/libs/commons-codec-1.3.jar +0 -0
- data/templates/cordova_android/framework/proguard-project.txt +20 -0
- data/templates/cordova_android/framework/project.properties +14 -0
- data/templates/cordova_android/framework/res/drawable/icon.png +0 -0
- data/templates/cordova_android/framework/res/drawable/splash.png +0 -0
- data/templates/cordova_android/framework/res/layout/main.xml +29 -0
- data/templates/cordova_android/framework/res/values/strings.xml +23 -0
- data/templates/cordova_android/framework/res/xml/cordova.xml +37 -0
- data/templates/cordova_android/framework/res/xml/plugins.xml +37 -0
- data/templates/cordova_android/framework/src/com/phonegap/api/IPlugin.java +27 -0
- data/templates/cordova_android/framework/src/com/phonegap/api/LOG.java +28 -0
- data/templates/cordova_android/framework/src/com/phonegap/api/PhonegapActivity.java +28 -0
- data/templates/cordova_android/framework/src/com/phonegap/api/Plugin.java +27 -0
- data/templates/cordova_android/framework/src/com/phonegap/api/PluginManager.java +35 -0
- data/templates/cordova_android/framework/src/com/phonegap/api/PluginResult.java +53 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/AccelListener.java +311 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/App.java +198 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/AudioHandler.java +364 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/AudioPlayer.java +450 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/AuthenticationToken.java +69 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/BatteryListener.java +156 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/CallbackServer.java +431 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/CameraLauncher.java +500 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/Capture.java +400 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/CompassListener.java +308 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/ContactAccessor.java +198 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/ContactAccessorSdk5.java +1934 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/ContactManager.java +113 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/CordovaChromeClient.java +314 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/CordovaWebViewClient.java +306 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/Device.java +219 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/DirectoryManager.java +161 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/DroidGap.java +1417 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/ExifHelper.java +165 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/FileTransfer.java +458 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/FileUploadResult.java +63 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/FileUtils.java +1048 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/GeoBroker.java +165 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/GeoListener.java +133 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/GpsListener.java +163 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/HttpHandler.java +80 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java +104 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/NetworkListener.java +153 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/NetworkManager.java +248 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/Notification.java +366 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/PreferenceNode.java +34 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/PreferenceSet.java +62 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/StandAlone.java +35 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/Storage.java +239 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/TempListener.java +112 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/api/CordovaInterface.java +145 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/api/IPlugin.java +116 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/api/LOG.java +234 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/api/Plugin.java +210 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/api/PluginManager.java +359 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/api/PluginResult.java +119 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/file/EncodingException.java +28 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/file/FileExistsException.java +28 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/file/InvalidModificationException.java +29 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/file/NoModificationAllowedException.java +28 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/file/TypeMismatchException.java +29 -0
- data/templates/cordova_android/framework/test/org/apache/cordova/PreferenceNodeTest.java +53 -0
- data/templates/cordova_android/framework/test/org/apache/cordova/PreferenceSetTest.java +73 -0
- metadata +279 -0
@@ -0,0 +1,359 @@
|
|
1
|
+
/*
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
4
|
+
distributed with this work for additional information
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
7
|
+
"License"); you may not use this file except in compliance
|
8
|
+
with the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
13
|
+
software distributed under the License is distributed on an
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
KIND, either express or implied. See the License for the
|
16
|
+
specific language governing permissions and limitations
|
17
|
+
under the License.
|
18
|
+
*/
|
19
|
+
package org.apache.cordova.api;
|
20
|
+
|
21
|
+
import java.io.IOException;
|
22
|
+
import java.util.HashMap;
|
23
|
+
import java.util.Iterator;
|
24
|
+
import java.util.Map.Entry;
|
25
|
+
|
26
|
+
import org.json.JSONArray;
|
27
|
+
import org.json.JSONException;
|
28
|
+
import org.xmlpull.v1.XmlPullParserException;
|
29
|
+
|
30
|
+
import android.content.Intent;
|
31
|
+
import android.content.res.XmlResourceParser;
|
32
|
+
import android.util.Log;
|
33
|
+
import android.webkit.WebView;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* PluginManager is exposed to JavaScript in the Cordova WebView.
|
37
|
+
*
|
38
|
+
* Calling native plugin code can be done by calling PluginManager.exec(...)
|
39
|
+
* from JavaScript.
|
40
|
+
*/
|
41
|
+
public class PluginManager {
|
42
|
+
|
43
|
+
private HashMap<String, IPlugin> plugins = new HashMap<String,IPlugin>();
|
44
|
+
private HashMap<String, String> services = new HashMap<String,String>();
|
45
|
+
|
46
|
+
private final CordovaInterface ctx;
|
47
|
+
private final WebView app;
|
48
|
+
|
49
|
+
// Map URL schemes like foo: to plugins that want to handle those schemes
|
50
|
+
// This would allow how all URLs are handled to be offloaded to a plugin
|
51
|
+
protected HashMap<String, String> urlMap = new HashMap<String,String>();
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Constructor.
|
55
|
+
*
|
56
|
+
* @param app
|
57
|
+
* @param ctx
|
58
|
+
*/
|
59
|
+
public PluginManager(WebView app, CordovaInterface ctx) {
|
60
|
+
this.ctx = ctx;
|
61
|
+
this.app = app;
|
62
|
+
this.loadPlugins();
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Re-init when loading a new HTML page into webview.
|
67
|
+
*/
|
68
|
+
public void reinit() {
|
69
|
+
|
70
|
+
// Stop plugins on current HTML page and discard
|
71
|
+
this.onPause(false);
|
72
|
+
this.onDestroy();
|
73
|
+
this.plugins = new HashMap<String, IPlugin>();
|
74
|
+
}
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Load plugins from res/xml/plugins.xml
|
78
|
+
*/
|
79
|
+
public void loadPlugins() {
|
80
|
+
int id = ctx.getResources().getIdentifier("plugins", "xml", ctx.getPackageName());
|
81
|
+
if (id == 0) { pluginConfigurationMissing(); }
|
82
|
+
XmlResourceParser xml = ctx.getResources().getXml(id);
|
83
|
+
int eventType = -1;
|
84
|
+
String pluginClass = "", pluginName = "";
|
85
|
+
while (eventType != XmlResourceParser.END_DOCUMENT) {
|
86
|
+
if (eventType == XmlResourceParser.START_TAG) {
|
87
|
+
String strNode = xml.getName();
|
88
|
+
if (strNode.equals("plugin")) {
|
89
|
+
pluginClass = xml.getAttributeValue(null, "value");
|
90
|
+
pluginName = xml.getAttributeValue(null, "name");
|
91
|
+
//System.out.println("Plugin: "+name+" => "+value);
|
92
|
+
this.addService(pluginName, pluginClass);
|
93
|
+
|
94
|
+
// Create plugin at load time if attribute "onload"
|
95
|
+
if ("true".equals(xml.getAttributeValue(null, "onload"))) {
|
96
|
+
this.getPlugin(pluginName);
|
97
|
+
}
|
98
|
+
} else if (strNode.equals("url-filter")) {
|
99
|
+
this.urlMap.put(xml.getAttributeValue(null, "value"), pluginName);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
try {
|
103
|
+
eventType = xml.next();
|
104
|
+
} catch (XmlPullParserException e) {
|
105
|
+
e.printStackTrace();
|
106
|
+
} catch (IOException e) {
|
107
|
+
e.printStackTrace();
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
/**
|
113
|
+
* Receives a request for execution and fulfills it by finding the appropriate
|
114
|
+
* Java class and calling it's execute method.
|
115
|
+
*
|
116
|
+
* PluginManager.exec can be used either synchronously or async. In either case, a JSON encoded
|
117
|
+
* string is returned that will indicate if any errors have occurred when trying to find
|
118
|
+
* or execute the class denoted by the clazz argument.
|
119
|
+
*
|
120
|
+
* @param service String containing the service to run
|
121
|
+
* @param action String containt the action that the class is supposed to perform. This is
|
122
|
+
* passed to the plugin execute method and it is up to the plugin developer
|
123
|
+
* how to deal with it.
|
124
|
+
* @param callbackId String containing the id of the callback that is execute in JavaScript if
|
125
|
+
* this is an async plugin call.
|
126
|
+
* @param args An Array literal string containing any arguments needed in the
|
127
|
+
* plugin execute method.
|
128
|
+
* @param async Boolean indicating whether the calling JavaScript code is expecting an
|
129
|
+
* immediate return value. If true, either Cordova.callbackSuccess(...) or
|
130
|
+
* Cordova.callbackError(...) is called once the plugin code has executed.
|
131
|
+
*
|
132
|
+
* @return JSON encoded string with a response message and status.
|
133
|
+
*/
|
134
|
+
@SuppressWarnings("unchecked")
|
135
|
+
public String exec(final String service, final String action, final String callbackId, final String jsonArgs, final boolean async) {
|
136
|
+
PluginResult cr = null;
|
137
|
+
boolean runAsync = async;
|
138
|
+
try {
|
139
|
+
final JSONArray args = new JSONArray(jsonArgs);
|
140
|
+
final IPlugin plugin = this.getPlugin(service);
|
141
|
+
final CordovaInterface ctx = this.ctx;
|
142
|
+
if (plugin != null) {
|
143
|
+
runAsync = async && !plugin.isSynch(action);
|
144
|
+
if (runAsync) {
|
145
|
+
// Run this on a different thread so that this one can return back to JS
|
146
|
+
Thread thread = new Thread(new Runnable() {
|
147
|
+
public void run() {
|
148
|
+
try {
|
149
|
+
// Call execute on the plugin so that it can do it's thing
|
150
|
+
PluginResult cr = plugin.execute(action, args, callbackId);
|
151
|
+
int status = cr.getStatus();
|
152
|
+
|
153
|
+
// If no result to be sent and keeping callback, then no need to sent back to JavaScript
|
154
|
+
if ((status == PluginResult.Status.NO_RESULT.ordinal()) && cr.getKeepCallback()) {
|
155
|
+
}
|
156
|
+
|
157
|
+
// Check the success (OK, NO_RESULT & !KEEP_CALLBACK)
|
158
|
+
else if ((status == PluginResult.Status.OK.ordinal()) || (status == PluginResult.Status.NO_RESULT.ordinal())) {
|
159
|
+
ctx.sendJavascript(cr.toSuccessCallbackString(callbackId));
|
160
|
+
}
|
161
|
+
|
162
|
+
// If error
|
163
|
+
else {
|
164
|
+
ctx.sendJavascript(cr.toErrorCallbackString(callbackId));
|
165
|
+
}
|
166
|
+
} catch (Exception e) {
|
167
|
+
PluginResult cr = new PluginResult(PluginResult.Status.ERROR, e.getMessage());
|
168
|
+
ctx.sendJavascript(cr.toErrorCallbackString(callbackId));
|
169
|
+
}
|
170
|
+
}
|
171
|
+
});
|
172
|
+
thread.start();
|
173
|
+
return "";
|
174
|
+
} else {
|
175
|
+
// Call execute on the plugin so that it can do it's thing
|
176
|
+
cr = plugin.execute(action, args, callbackId);
|
177
|
+
|
178
|
+
// If no result to be sent and keeping callback, then no need to sent back to JavaScript
|
179
|
+
if ((cr.getStatus() == PluginResult.Status.NO_RESULT.ordinal()) && cr.getKeepCallback()) {
|
180
|
+
return "";
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}
|
184
|
+
} catch (JSONException e) {
|
185
|
+
System.out.println("ERROR: "+e.toString());
|
186
|
+
cr = new PluginResult(PluginResult.Status.JSON_EXCEPTION);
|
187
|
+
}
|
188
|
+
// if async we have already returned at this point unless there was an error...
|
189
|
+
if (runAsync) {
|
190
|
+
if (cr == null) {
|
191
|
+
cr = new PluginResult(PluginResult.Status.CLASS_NOT_FOUND_EXCEPTION);
|
192
|
+
}
|
193
|
+
ctx.sendJavascript(cr.toErrorCallbackString(callbackId));
|
194
|
+
}
|
195
|
+
return ( cr != null ? cr.getJSONString() : "{ status: 0, message: 'all good' }" );
|
196
|
+
}
|
197
|
+
|
198
|
+
/**
|
199
|
+
* Get the class.
|
200
|
+
*
|
201
|
+
* @param clazz
|
202
|
+
* @return
|
203
|
+
* @throws ClassNotFoundException
|
204
|
+
*/
|
205
|
+
@SuppressWarnings("unchecked")
|
206
|
+
private Class getClassByName(final String clazz) throws ClassNotFoundException {
|
207
|
+
Class c = null;
|
208
|
+
if (clazz != null) {
|
209
|
+
c = Class.forName(clazz);
|
210
|
+
}
|
211
|
+
return c;
|
212
|
+
}
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Get the interfaces that a class implements and see if it implements the
|
216
|
+
* org.apache.cordova.api.Plugin interface.
|
217
|
+
*
|
218
|
+
* @param c The class to check the interfaces of.
|
219
|
+
* @return Boolean indicating if the class implements org.apache.cordova.api.Plugin
|
220
|
+
*/
|
221
|
+
@SuppressWarnings("unchecked")
|
222
|
+
private boolean isCordovaPlugin(Class c) {
|
223
|
+
if (c != null) {
|
224
|
+
return org.apache.cordova.api.Plugin.class.isAssignableFrom(c) || org.apache.cordova.api.IPlugin.class.isAssignableFrom(c);
|
225
|
+
}
|
226
|
+
return false;
|
227
|
+
}
|
228
|
+
|
229
|
+
/**
|
230
|
+
* Add plugin to be loaded and cached. This creates an instance of the plugin.
|
231
|
+
* If plugin is already created, then just return it.
|
232
|
+
*
|
233
|
+
* @param className The class to load
|
234
|
+
* @param clazz The class object (must be a class object of the className)
|
235
|
+
* @param callbackId The callback id to use when calling back into JavaScript
|
236
|
+
* @return The plugin
|
237
|
+
*/
|
238
|
+
@SuppressWarnings("unchecked")
|
239
|
+
private IPlugin addPlugin(String pluginName, String className) {
|
240
|
+
try {
|
241
|
+
Class c = getClassByName(className);
|
242
|
+
if (isCordovaPlugin(c)) {
|
243
|
+
IPlugin plugin = (IPlugin)c.newInstance();
|
244
|
+
this.plugins.put(className, plugin);
|
245
|
+
plugin.setContext(this.ctx);
|
246
|
+
plugin.setView(this.app);
|
247
|
+
return plugin;
|
248
|
+
}
|
249
|
+
} catch (Exception e) {
|
250
|
+
e.printStackTrace();
|
251
|
+
System.out.println("Error adding plugin "+className+".");
|
252
|
+
}
|
253
|
+
return null;
|
254
|
+
}
|
255
|
+
|
256
|
+
/**
|
257
|
+
* Get the loaded plugin.
|
258
|
+
*
|
259
|
+
* If the plugin is not already loaded then load it.
|
260
|
+
*
|
261
|
+
* @param className The class of the loaded plugin.
|
262
|
+
* @return
|
263
|
+
*/
|
264
|
+
private IPlugin getPlugin(String pluginName) {
|
265
|
+
String className = this.services.get(pluginName);
|
266
|
+
if (this.plugins.containsKey(className)) {
|
267
|
+
return this.plugins.get(className);
|
268
|
+
} else {
|
269
|
+
return this.addPlugin(pluginName, className);
|
270
|
+
}
|
271
|
+
}
|
272
|
+
|
273
|
+
/**
|
274
|
+
* Add a class that implements a service.
|
275
|
+
* This does not create the class instance. It just maps service name to class name.
|
276
|
+
*
|
277
|
+
* @param serviceType
|
278
|
+
* @param className
|
279
|
+
*/
|
280
|
+
public void addService(String serviceType, String className) {
|
281
|
+
this.services.put(serviceType, className);
|
282
|
+
}
|
283
|
+
|
284
|
+
/**
|
285
|
+
* Called when the system is about to start resuming a previous activity.
|
286
|
+
*
|
287
|
+
* @param multitasking Flag indicating if multitasking is turned on for app
|
288
|
+
*/
|
289
|
+
public void onPause(boolean multitasking) {
|
290
|
+
for (IPlugin plugin : this.plugins.values()) {
|
291
|
+
plugin.onPause(multitasking);
|
292
|
+
}
|
293
|
+
}
|
294
|
+
|
295
|
+
/**
|
296
|
+
* Called when the activity will start interacting with the user.
|
297
|
+
*
|
298
|
+
* @param multitasking Flag indicating if multitasking is turned on for app
|
299
|
+
*/
|
300
|
+
public void onResume(boolean multitasking) {
|
301
|
+
for (IPlugin plugin : this.plugins.values()) {
|
302
|
+
plugin.onResume(multitasking);
|
303
|
+
}
|
304
|
+
}
|
305
|
+
|
306
|
+
/**
|
307
|
+
* The final call you receive before your activity is destroyed.
|
308
|
+
*/
|
309
|
+
public void onDestroy() {
|
310
|
+
for (IPlugin plugin : this.plugins.values()) {
|
311
|
+
plugin.onDestroy();
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
315
|
+
/**
|
316
|
+
* Send a message to all plugins.
|
317
|
+
*
|
318
|
+
* @param id The message id
|
319
|
+
* @param data The message data
|
320
|
+
*/
|
321
|
+
public void postMessage(String id, Object data) {
|
322
|
+
for (IPlugin plugin : this.plugins.values()) {
|
323
|
+
plugin.onMessage(id, data);
|
324
|
+
}
|
325
|
+
}
|
326
|
+
|
327
|
+
/**
|
328
|
+
* Called when the activity receives a new intent.
|
329
|
+
*/
|
330
|
+
public void onNewIntent(Intent intent) {
|
331
|
+
for (IPlugin plugin : this.plugins.values()) {
|
332
|
+
plugin.onNewIntent(intent);
|
333
|
+
}
|
334
|
+
}
|
335
|
+
|
336
|
+
/**
|
337
|
+
* Called when the URL of the webview changes.
|
338
|
+
*
|
339
|
+
* @param url The URL that is being changed to.
|
340
|
+
* @return Return false to allow the URL to load, return true to prevent the URL from loading.
|
341
|
+
*/
|
342
|
+
public boolean onOverrideUrlLoading(String url) {
|
343
|
+
Iterator<Entry<String, String>> it = this.urlMap.entrySet().iterator();
|
344
|
+
while (it.hasNext()) {
|
345
|
+
HashMap.Entry<String, String> pairs = it.next();
|
346
|
+
if (url.startsWith(pairs.getKey())) {
|
347
|
+
return this.getPlugin(pairs.getValue()).onOverrideUrlLoading(url);
|
348
|
+
}
|
349
|
+
}
|
350
|
+
return false;
|
351
|
+
}
|
352
|
+
|
353
|
+
private void pluginConfigurationMissing() {
|
354
|
+
System.err.println("=====================================================================================");
|
355
|
+
System.err.println("ERROR: plugin.xml is missing. Add res/xml/plugins.xml to your project.");
|
356
|
+
System.err.println("https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/res/xml/plugins.xml");
|
357
|
+
System.err.println("=====================================================================================");
|
358
|
+
}
|
359
|
+
}
|
@@ -0,0 +1,119 @@
|
|
1
|
+
/*
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
4
|
+
distributed with this work for additional information
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
7
|
+
"License"); you may not use this file except in compliance
|
8
|
+
with the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
13
|
+
software distributed under the License is distributed on an
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
KIND, either express or implied. See the License for the
|
16
|
+
specific language governing permissions and limitations
|
17
|
+
under the License.
|
18
|
+
*/
|
19
|
+
package org.apache.cordova.api;
|
20
|
+
|
21
|
+
import org.json.JSONArray;
|
22
|
+
import org.json.JSONObject;
|
23
|
+
|
24
|
+
import android.util.Log;
|
25
|
+
|
26
|
+
public class PluginResult {
|
27
|
+
private final int status;
|
28
|
+
private final String message;
|
29
|
+
private boolean keepCallback = false;
|
30
|
+
|
31
|
+
public PluginResult(Status status) {
|
32
|
+
this.status = status.ordinal();
|
33
|
+
this.message = "'" + PluginResult.StatusMessages[this.status] + "'";
|
34
|
+
}
|
35
|
+
|
36
|
+
public PluginResult(Status status, String message) {
|
37
|
+
this.status = status.ordinal();
|
38
|
+
this.message = JSONObject.quote(message);
|
39
|
+
}
|
40
|
+
|
41
|
+
public PluginResult(Status status, JSONArray message) {
|
42
|
+
this.status = status.ordinal();
|
43
|
+
this.message = message.toString();
|
44
|
+
}
|
45
|
+
|
46
|
+
public PluginResult(Status status, JSONObject message) {
|
47
|
+
this.status = status.ordinal();
|
48
|
+
this.message = message.toString();
|
49
|
+
}
|
50
|
+
|
51
|
+
public PluginResult(Status status, int i) {
|
52
|
+
this.status = status.ordinal();
|
53
|
+
this.message = ""+i;
|
54
|
+
}
|
55
|
+
|
56
|
+
public PluginResult(Status status, float f) {
|
57
|
+
this.status = status.ordinal();
|
58
|
+
this.message = ""+f;
|
59
|
+
}
|
60
|
+
|
61
|
+
public PluginResult(Status status, boolean b) {
|
62
|
+
this.status = status.ordinal();
|
63
|
+
this.message = ""+b;
|
64
|
+
}
|
65
|
+
|
66
|
+
public void setKeepCallback(boolean b) {
|
67
|
+
this.keepCallback = b;
|
68
|
+
}
|
69
|
+
|
70
|
+
public int getStatus() {
|
71
|
+
return status;
|
72
|
+
}
|
73
|
+
|
74
|
+
public String getMessage() {
|
75
|
+
return message;
|
76
|
+
}
|
77
|
+
|
78
|
+
public boolean getKeepCallback() {
|
79
|
+
return this.keepCallback;
|
80
|
+
}
|
81
|
+
|
82
|
+
public String getJSONString() {
|
83
|
+
return "{status:" + this.status + ",message:" + this.message + ",keepCallback:" + this.keepCallback + "}";
|
84
|
+
}
|
85
|
+
|
86
|
+
public String toSuccessCallbackString(String callbackId) {
|
87
|
+
return "require('cordova').callbackSuccess('"+callbackId+"',"+this.getJSONString()+");";
|
88
|
+
}
|
89
|
+
|
90
|
+
public String toErrorCallbackString(String callbackId) {
|
91
|
+
return "require('cordova').callbackError('"+callbackId+"', " + this.getJSONString()+ ");";
|
92
|
+
}
|
93
|
+
|
94
|
+
public static String[] StatusMessages = new String[] {
|
95
|
+
"No result",
|
96
|
+
"OK",
|
97
|
+
"Class not found",
|
98
|
+
"Illegal access",
|
99
|
+
"Instantiation error",
|
100
|
+
"Malformed url",
|
101
|
+
"IO error",
|
102
|
+
"Invalid action",
|
103
|
+
"JSON error",
|
104
|
+
"Error"
|
105
|
+
};
|
106
|
+
|
107
|
+
public enum Status {
|
108
|
+
NO_RESULT,
|
109
|
+
OK,
|
110
|
+
CLASS_NOT_FOUND_EXCEPTION,
|
111
|
+
ILLEGAL_ACCESS_EXCEPTION,
|
112
|
+
INSTANTIATION_EXCEPTION,
|
113
|
+
MALFORMED_URL_EXCEPTION,
|
114
|
+
IO_EXCEPTION,
|
115
|
+
INVALID_ACTION,
|
116
|
+
JSON_EXCEPTION,
|
117
|
+
ERROR
|
118
|
+
}
|
119
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/*
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
4
|
+
distributed with this work for additional information
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
7
|
+
"License"); you may not use this file except in compliance
|
8
|
+
with the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
13
|
+
software distributed under the License is distributed on an
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
KIND, either express or implied. See the License for the
|
16
|
+
specific language governing permissions and limitations
|
17
|
+
under the License.
|
18
|
+
*/
|
19
|
+
|
20
|
+
package org.apache.cordova.file;
|
21
|
+
|
22
|
+
public class EncodingException extends Exception {
|
23
|
+
|
24
|
+
public EncodingException(String message) {
|
25
|
+
super(message);
|
26
|
+
}
|
27
|
+
|
28
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/*
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
4
|
+
distributed with this work for additional information
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
7
|
+
"License"); you may not use this file except in compliance
|
8
|
+
with the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
13
|
+
software distributed under the License is distributed on an
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
KIND, either express or implied. See the License for the
|
16
|
+
specific language governing permissions and limitations
|
17
|
+
under the License.
|
18
|
+
*/
|
19
|
+
|
20
|
+
package org.apache.cordova.file;
|
21
|
+
|
22
|
+
public class FileExistsException extends Exception {
|
23
|
+
|
24
|
+
public FileExistsException(String msg) {
|
25
|
+
super(msg);
|
26
|
+
}
|
27
|
+
|
28
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/*
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
4
|
+
distributed with this work for additional information
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
7
|
+
"License"); you may not use this file except in compliance
|
8
|
+
with the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
13
|
+
software distributed under the License is distributed on an
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
KIND, either express or implied. See the License for the
|
16
|
+
specific language governing permissions and limitations
|
17
|
+
under the License.
|
18
|
+
*/
|
19
|
+
|
20
|
+
|
21
|
+
package org.apache.cordova.file;
|
22
|
+
|
23
|
+
public class InvalidModificationException extends Exception {
|
24
|
+
|
25
|
+
public InvalidModificationException(String message) {
|
26
|
+
super(message);
|
27
|
+
}
|
28
|
+
|
29
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/*
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
4
|
+
distributed with this work for additional information
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
7
|
+
"License"); you may not use this file except in compliance
|
8
|
+
with the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
13
|
+
software distributed under the License is distributed on an
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
KIND, either express or implied. See the License for the
|
16
|
+
specific language governing permissions and limitations
|
17
|
+
under the License.
|
18
|
+
*/
|
19
|
+
|
20
|
+
package org.apache.cordova.file;
|
21
|
+
|
22
|
+
public class NoModificationAllowedException extends Exception {
|
23
|
+
|
24
|
+
public NoModificationAllowedException(String message) {
|
25
|
+
super(message);
|
26
|
+
}
|
27
|
+
|
28
|
+
}
|
data/templates/cordova_android/framework/src/org/apache/cordova/file/TypeMismatchException.java
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
/*
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
4
|
+
distributed with this work for additional information
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
7
|
+
"License"); you may not use this file except in compliance
|
8
|
+
with the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
13
|
+
software distributed under the License is distributed on an
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
KIND, either express or implied. See the License for the
|
16
|
+
specific language governing permissions and limitations
|
17
|
+
under the License.
|
18
|
+
*/
|
19
|
+
|
20
|
+
|
21
|
+
package org.apache.cordova.file;
|
22
|
+
|
23
|
+
public class TypeMismatchException extends Exception {
|
24
|
+
|
25
|
+
public TypeMismatchException(String message) {
|
26
|
+
super(message);
|
27
|
+
}
|
28
|
+
|
29
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/*
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
4
|
+
distributed with this work for additional information
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
7
|
+
"License"); you may not use this file except in compliance
|
8
|
+
with the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
13
|
+
software distributed under the License is distributed on an
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
KIND, either express or implied. See the License for the
|
16
|
+
specific language governing permissions and limitations
|
17
|
+
under the License.
|
18
|
+
*/
|
19
|
+
import org.junit.*;
|
20
|
+
import static org.junit.Assert.*;
|
21
|
+
|
22
|
+
import org.apache.cordova.PreferenceNode;
|
23
|
+
|
24
|
+
public class PreferenceNodeTest {
|
25
|
+
@Test
|
26
|
+
public void testConstructor() {
|
27
|
+
PreferenceNode foo = new org.apache.cordova.PreferenceNode("fullscreen", "false", false);
|
28
|
+
assertEquals("fullscreen", foo.name);
|
29
|
+
assertEquals("false", foo.value);
|
30
|
+
assertEquals(false, foo.readonly);
|
31
|
+
}
|
32
|
+
|
33
|
+
@Test
|
34
|
+
public void testNameAssignment() {
|
35
|
+
PreferenceNode foo = new org.apache.cordova.PreferenceNode("fullscreen", "false", false);
|
36
|
+
foo.name = "widescreen";
|
37
|
+
assertEquals("widescreen", foo.name);
|
38
|
+
}
|
39
|
+
|
40
|
+
@Test
|
41
|
+
public void testValueAssignment() {
|
42
|
+
PreferenceNode foo = new org.apache.cordova.PreferenceNode("fullscreen", "false", false);
|
43
|
+
foo.value = "maybe";
|
44
|
+
assertEquals("maybe", foo.value);
|
45
|
+
}
|
46
|
+
|
47
|
+
@Test
|
48
|
+
public void testReadonlyAssignment() {
|
49
|
+
PreferenceNode foo = new org.apache.cordova.PreferenceNode("fullscreen", "false", false);
|
50
|
+
foo.readonly = true;
|
51
|
+
assertEquals(true, foo.readonly);
|
52
|
+
}
|
53
|
+
}
|