Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Orientation support #33

Merged
merged 3 commits into from

1 participant

Elliot Smith
Elliot Smith
Owner

Add support to set the android:screenOrientation on the activity in the AndroidManifest.xml file.

Adds an --orientation option to the command line tools as well.

Fixes #11

Elliot Smith townxelliot merged commit 314e1af into from
Elliot Smith townxelliot deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 10, 2014
  1. Elliot Smith

    Support orientation property

    townxelliot authored
    Inserts an android:screenOrientation attribute into the <activity>
    element of the Android manifest.
  2. Elliot Smith
  3. Elliot Smith
This page is out of date. Refresh to see the latest.
1  data/xwalk-app-skeleton/AndroidManifest.xml.template
View
@@ -12,6 +12,7 @@
android:hardwareAccelerated="true"
android:icon="@drawable/<%= iconName %>">
<activity android:name="<%= pkg + '.' + activityClassName %>"
+ <% if (orientation) { %>android:screenOrientation="<%= orientation %>"<% } %>
android:theme="@android:style/<%= theme %>"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize"
android:label="<%= name %>">
7 src/app.js
View
@@ -86,6 +86,10 @@ var replaceInvalidChars = function (value, mode) {
* set to true to enable remote debugging on the device
* @param {boolean} [config.fullscreen=App.CONFIG_DEFAULTS.fullscreen] -
* set to false to run the app in windowed mode
+ * @param {boolean} [config.orientation=undefined] - android:screenOrientation
+ * setting; see
+ * http://developer.android.com/guide/topics/manifest/activity-element.html#screenOrientation
+ * for valid values
* @param {string} [config.theme=App.CONFIG_DEFAULTS.theme] - Android
* theme string, for use in AndroidManifest.xml; this should NOT be
* set to a fullscreen theme, as this is added automatically if
@@ -161,7 +165,8 @@ App.CONFIG_DEFAULTS = {
javaSrcDirs: [],
extensions: null,
embedded: true,
- version: null
+ version: null,
+ orientation: null
};
/**
1  src/env.js
View
@@ -509,6 +509,7 @@ Env.prototype.build = function (app, locations) {
extensions: _.clone(app.extensions),
remoteDebugging: app.remoteDebugging,
+ orientation: app.orientation,
targetSdkVersion: this.androidAPILevel
};
5 src/xwalk-apkgen.js
View
@@ -155,6 +155,11 @@ var cliOpts = {
},
// app optional
+ 'orientation': {
+ describe: 'orientation for the application (e.g. "portrait", "landscape")',
+ section: 'Application (app)'
+ },
+
'icon': {
describe: 'path to the icon file for the application',
section: 'Application (app)',
2  test/functional/make-apk-with-extensions.test.sh
View
@@ -18,4 +18,4 @@ fi
WD=`dirname $0`
OUT_DIR=$WD/build/make-apk-with-extensions
-$WD/../../bin/xwalk_apkgen --embedded --app-root $WD/app-with-extensions/app --app-local-path index.html --name "X make apk with extensions test sh" --package "make.apk.with.extensions" --remoteDebugging --ext-config $WD/app-with-extensions/xwalk-extensions/config.json --jars $WD/app-with-extensions/jars/commons-io-2.4.jar,$WD/app-with-extensions/jars/commons-lang3-3.1.jar,$WD/app-with-extensions/jars/entagged-audioformats-0.15.jar,$WD/app-with-extensions/jars/gson-2.2.4.jar --javaSrcDirs $WD/app-with-extensions/xwalk-extensions/java/ -a $androidSDKDir -x $xwalkAndroidDir -o $OUT_DIR --version 1.0.0 $*
+$WD/../../bin/xwalk_apkgen --orientation portrait --embedded --app-root $WD/app-with-extensions/app --app-local-path index.html --name "X make apk with extensions test sh" --package "make.apk.with.extensions" --remoteDebugging --ext-config $WD/app-with-extensions/xwalk-extensions/config.json --jars $WD/app-with-extensions/jars/commons-io-2.4.jar,$WD/app-with-extensions/jars/commons-lang3-3.1.jar,$WD/app-with-extensions/jars/entagged-audioformats-0.15.jar,$WD/app-with-extensions/jars/gson-2.2.4.jar --javaSrcDirs $WD/app-with-extensions/xwalk-extensions/java/ -a $androidSDKDir -x $xwalkAndroidDir -o $OUT_DIR --version 1.0.0 $*
3  test/unit/app-skeleton.test.js
View
@@ -51,7 +51,8 @@ describe('AppSkeleton', function () {
targetSdkVersion: 19,
javaSrcDirs: [],
extensionsJsFiles: [],
- version: '1.0.0'
+ version: '1.0.0',
+ orientation: null
};
// Locations object pointing at the output directory
Something went wrong with that request. Please try again.