cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [1/2] git commit: CB-5634 Set Android orientation from config.xml
Date Thu, 13 Feb 2014 02:39:12 GMT
Updated Branches:
  refs/heads/master f323e809a -> 0b1417772


CB-5634 Set Android orientation from config.xml


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/8a4e6a6b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/8a4e6a6b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/8a4e6a6b

Branch: refs/heads/master
Commit: 8a4e6a6b1725bb057937ae8ccc6ab0c5af3613de
Parents: f323e80
Author: Darryl Pogue <darryl@dpogue.ca>
Authored: Wed Dec 11 13:44:21 2013 -0800
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Wed Feb 12 21:06:57 2014 -0500

----------------------------------------------------------------------
 src/metadata/android_parser.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/8a4e6a6b/src/metadata/android_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/android_parser.js b/src/metadata/android_parser.js
index ca8a652..5d2acdb 100644
--- a/src/metadata/android_parser.js
+++ b/src/metadata/android_parser.js
@@ -71,6 +71,18 @@ module.exports.prototype = {
         var orig_pkg = manifest.getroot().attrib.package;
         manifest.getroot().attrib.package = pkg;
 
+        // Set the orientation in the AndroidManifest
+        var preferences = config.preference.get();
+        var act = manifest.getroot().find('./application/activity');
+        delete act.attrib["android:screenOrientation"];
+        for (var i = 0, ii = preferences.length; i < ii; ++i) {
+            if (preferences[i].name.toLowerCase() === 'orientation' &&
+                preferences[i].value.toLowerCase() !== 'default')
+            {
+                act.attrib["android:screenOrientation"] = preferences[i].value;
+            }
+        }
+
         // Write out AndroidManifest.xml
         fs.writeFileSync(this.manifest, manifest.write({indent: 4}), 'utf-8');
 


Mime
View raw message