incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/4] android commit: adding appinfo
Date Sat, 16 Jun 2012 01:40:06 GMT
adding appinfo


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/e6d801a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/e6d801a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/e6d801a5

Branch: refs/heads/master
Commit: e6d801a5946c472b4acf73f0dff2ead41907f448
Parents: 0aec2be
Author: Anis Kadri <anis.kadri@gmail.com>
Authored: Fri Jun 15 18:38:46 2012 -0700
Committer: Anis Kadri <anis.kadri@gmail.com>
Committed: Fri Jun 15 18:38:46 2012 -0700

----------------------------------------------------------------------
 .../cordova/ApplicationInfo/ApplicationInfo.class  |  Bin 0 -> 1941 bytes
 .../cordova/ApplicationInfo/ApplicationInfo.java   |   44 +++++++++++++++
 bin/templates/cordova/ApplicationInfo/manifest.txt |    1 +
 3 files changed, 45 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e6d801a5/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class b/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class
new file mode 100644
index 0000000..6b854f7
Binary files /dev/null and b/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e6d801a5/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java b/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java
new file mode 100644
index 0000000..9a66321
--- /dev/null
+++ b/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java
@@ -0,0 +1,44 @@
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.xml.sax.SAXException;
+import java.io.IOException;
+
+public class ApplicationInfo {
+    private static void parseAndroidManifest(String path) {
+        // System.out.println(path);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        Document dom;
+        try {
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            dom = db.parse(path);
+
+            // getting package information
+            Element manifest = dom.getDocumentElement();
+            String pakkage = manifest.getAttribute("package");
+
+            // getting activity name
+            String activity = ((Element)dom.getElementsByTagName("activity").item(0)).getAttribute("android:name");
+            System.out.println(String.format("%s/%s.%s", pakkage, pakkage, activity));
+        } catch(ParserConfigurationException pce) {
+			pce.printStackTrace();
+		} catch(SAXException se) {
+			se.printStackTrace();
+		} catch(IOException ioe) {
+			ioe.printStackTrace();
+		}
+        
+    }
+
+    public static void main(String[] args) {
+        String path;
+        if(args.length > 0) {
+            path = args[0];
+        } else {
+            path = System.getProperty("user.dir") + "/../AndroidManifest.xml";
+        }
+        parseAndroidManifest(path);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e6d801a5/bin/templates/cordova/ApplicationInfo/manifest.txt
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/ApplicationInfo/manifest.txt b/bin/templates/cordova/ApplicationInfo/manifest.txt
new file mode 100644
index 0000000..7d77999
--- /dev/null
+++ b/bin/templates/cordova/ApplicationInfo/manifest.txt
@@ -0,0 +1 @@
+Main-Class: ApplicationInfo


Mime
View raw message