Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D3A13F44C for ; Fri, 10 May 2013 21:03:27 +0000 (UTC) Received: (qmail 30561 invoked by uid 500); 10 May 2013 21:03:27 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 30521 invoked by uid 500); 10 May 2013 21:03:27 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 30464 invoked by uid 99); 10 May 2013 21:03:27 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 May 2013 21:03:27 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EFB1E88B8F9; Fri, 10 May 2013 21:03:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bowserj@apache.org To: commits@cordova.apache.org Date: Fri, 10 May 2013 21:03:27 -0000 Message-Id: <2f2c6110c7a24f9caa4c3654016f2b3c@git.apache.org> In-Reply-To: <28a63e860572400682266b4ce2a627fa@git.apache.org> References: <28a63e860572400682266b4ce2a627fa@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/13] android commit: [CB-1108] Convert config.xml from to [CB-1108] Convert config.xml from to This unifies the config.xml used by iOS and Android. Now tags can be used to add plugins. The changes are non-intrusive so the older versions of the config.xml can still be used after this change. The value of a param named "android-package" determines the class for the plugin. Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/4b9047b7 Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/4b9047b7 Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/4b9047b7 Branch: refs/heads/3.0.0 Commit: 4b9047b7d8ef8b983bd3d107c20620a54474d269 Parents: d226818 Author: Gorkem Ercan Authored: Thu Mar 28 10:22:08 2013 +0200 Committer: Andrew Grieve Committed: Fri May 3 11:35:00 2013 -0400 ---------------------------------------------------------------------- framework/res/xml/config.xml | 123 ++++++++------ .../src/org/apache/cordova/api/PluginManager.java | 39 +++-- test/res/xml/config.xml | 135 +++++++++------ 3 files changed, 177 insertions(+), 120 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4b9047b7/framework/res/xml/config.xml ---------------------------------------------------------------------- diff --git a/framework/res/xml/config.xml b/framework/res/xml/config.xml index bc6ca0c..c915f0c 100644 --- a/framework/res/xml/config.xml +++ b/framework/res/xml/config.xml @@ -1,60 +1,85 @@ - - - - + + Apache Cordova Team + - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4b9047b7/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 7d823cd..4cf3450 100755 --- a/framework/src/org/apache/cordova/api/PluginManager.java +++ b/framework/src/org/apache/cordova/api/PluginManager.java @@ -107,7 +107,7 @@ public class PluginManager { } XmlResourceParser xml = this.ctx.getActivity().getResources().getXml(id); int eventType = -1; - String service = "", pluginClass = "", paramType = ""; + String service = "", pluginClass = "", paramType = "", featureName=""; boolean onload = false; PluginEntry entry = null; boolean insideFeature = false; @@ -130,26 +130,28 @@ public class PluginManager { } else if (strNode.equals("feature")) { insideFeature = true; - //Check for supported feature sets (Accelerometer, Geolocation, etc) + //Check for supported feature sets aka. plugins (Accelerometer, Geolocation, etc) //Set the bit for reading params - String uri = xml.getAttributeValue(null,"name"); + featureName = xml.getAttributeValue(null,"name"); } - else if(strNode.equals("param")) { - if(insideFeature) + 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")) { - paramType = xml.getAttributeValue(null, "name"); - if(paramType.equals("service")) - service = xml.getAttributeValue(null, "value"); - else if(paramType.equals("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 = ""; - } + service = featureName; + 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 = ""; } } } @@ -161,6 +163,7 @@ public class PluginManager { //Empty the strings to prevent plugin loading bugs service = ""; pluginClass = ""; + featureName =""; insideFeature = false; } } http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4b9047b7/test/res/xml/config.xml ---------------------------------------------------------------------- diff --git a/test/res/xml/config.xml b/test/res/xml/config.xml index 675aeb5..d3ea4d8 100644 --- a/test/res/xml/config.xml +++ b/test/res/xml/config.xml @@ -1,57 +1,86 @@ - - - - - - - - - - + + + Hello Cordova + + + A sample Apache Cordova application that responds to the deviceready event. + + + + Apache Cordova Team + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +