You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2013/05/10 23:03:29 UTC
[04/13] android commit: [CB-1108] Make onload=true settable as a
[CB-1108] Make onload=true settable as a <feature> <param>
Plus some simplification of code.
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/373da39a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/373da39a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/373da39a
Branch: refs/heads/3.0.0
Commit: 373da39ac2c9abfbf7866d76e3ace3ecc360ec96
Parents: b7990b7
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri May 3 12:18:21 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri May 3 12:18:21 2013 -0400
----------------------------------------------------------------------
.../src/org/apache/cordova/api/PluginManager.java | 35 +++++----------
1 files changed, 11 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/373da39a/framework/src/org/apache/cordova/api/PluginManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/api/PluginManager.java b/framework/src/org/apache/cordova/api/PluginManager.java
index 4cf3450..36e286e 100755
--- a/framework/src/org/apache/cordova/api/PluginManager.java
+++ b/framework/src/org/apache/cordova/api/PluginManager.java
@@ -107,9 +107,8 @@ public class PluginManager {
}
XmlResourceParser xml = this.ctx.getActivity().getResources().getXml(id);
int eventType = -1;
- String service = "", pluginClass = "", paramType = "", featureName="";
+ String service = "", pluginClass = "", paramType = "";
boolean onload = false;
- PluginEntry entry = null;
boolean insideFeature = false;
while (eventType != XmlResourceParser.END_DOCUMENT) {
if (eventType == XmlResourceParser.START_TAG) {
@@ -118,52 +117,40 @@ public class PluginManager {
if (strNode.equals("plugin")) {
service = xml.getAttributeValue(null, "name");
pluginClass = xml.getAttributeValue(null, "value");
- // System.out.println("Plugin: "+name+" => "+value);
Log.d(TAG, "<plugin> tags are deprecated, please use <features> instead. <plugin> will no longer work as of Cordova 3.0");
onload = "true".equals(xml.getAttributeValue(null, "onload"));
- entry = new PluginEntry(service, pluginClass, onload);
- this.addService(entry);
}
//What is this?
else if (strNode.equals("url-filter")) {
this.urlMap.put(xml.getAttributeValue(null, "value"), service);
}
else if (strNode.equals("feature")) {
- insideFeature = true;
//Check for supported feature sets aka. plugins (Accelerometer, Geolocation, etc)
//Set the bit for reading params
- featureName = xml.getAttributeValue(null,"name");
+ insideFeature = true;
+ service = xml.getAttributeValue(null, "name");
}
- else if( insideFeature && strNode.equals("param")) {
+ else if (insideFeature && strNode.equals("param")) {
paramType = xml.getAttributeValue(null, "name");
if (paramType.equals("service")) // check if it is using the older service param
service = xml.getAttributeValue(null, "value");
- else if (paramType.equals("package"))
- pluginClass = xml.getAttributeValue(null, "value");
- else if (paramType.equals("android-package"))
- {
- service = featureName;
+ else if (paramType.equals("package") || paramType.equals("android-package"))
pluginClass = xml.getAttributeValue(null,"value");
- }
- if (service.length() > 0 && pluginClass.length() > 0) {
- onload = "true".equals(xml.getAttributeValue(null,
- "onload"));
- entry = new PluginEntry(service, pluginClass, onload);
- this.addService(entry);
- service = "";
- pluginClass = "";
- }
+ else if (paramType.equals("onload"))
+ onload = "true".equals(xml.getAttributeValue(null, "onload"));
}
}
else if (eventType == XmlResourceParser.END_TAG)
{
String strNode = xml.getName();
- if(strNode.equals("feature"))
+ if (strNode.equals("feature") || strNode.equals("plugin"))
{
+ PluginEntry entry = new PluginEntry(service, pluginClass, onload);
+ this.addService(entry);
+
//Empty the strings to prevent plugin loading bugs
service = "";
pluginClass = "";
- featureName ="";
insideFeature = false;
}
}