From 4bdda8f9ad0b1d9d60345b2947ede3d15c5abc12 Mon Sep 17 00:00:00 2001 From: Jinhyuk Jun Date: Thu, 14 Mar 2013 16:39:49 +0900 Subject: [PATCH] Orientation : add orientataionchange to tizen-winset Change-Id: Ia88935507dcaee18de81475f17377b1290f32e09 Conflicts: demos/tizen-winsets/index.html --- demos/tizen-winsets/index.html | 1 + demos/tizen-winsets/webappOrientation.js | 27 +++++++++++++++++++++++++++ src/template/tizen/config.xml.in | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 demos/tizen-winsets/webappOrientation.js diff --git a/demos/tizen-winsets/index.html b/demos/tizen-winsets/index.html index 3206dac..bade78c 100644 --- a/demos/tizen-winsets/index.html +++ b/demos/tizen-winsets/index.html @@ -12,6 +12,7 @@ + Tizen UI diff --git a/demos/tizen-winsets/webappOrientation.js b/demos/tizen-winsets/webappOrientation.js new file mode 100644 index 0000000..88043f9 --- /dev/null +++ b/demos/tizen-winsets/webappOrientation.js @@ -0,0 +1,27 @@ +function onSuccessCallback ( ori ) { + console.log( ori.status ); + if ( ori.status === "PORTRAIT_PRIMARY" ) { + window.screen.lockOrientation( "portrait-primary" ); + } + else if ( ori.status === "PORTRAIT_SECONDARY" ) { + window.screen.lockOrientation( "portrait-secondary" ); + } + else if ( ori.status === "LANDSCAPE_PRIMARY" ) { + window.screen.lockOrientation( "landscape-primary" ); + } + else if ( ori.status === "LANDSCAPE_SECONDARY" ) { + window.screen.lockOrientation( "landscape-secondary" ); + } +} +function onErrorCallback ( error ) { + console.log( "An error occurred " + error.message ); +} + +try { + if ( $.tizen.__tizen__.util.isMobileBrowser() ) { + tizen.systeminfo.addPropertyValueChangeListener( "DEVICE_ORIENTATION", onSuccessCallback, onErrorCallback ); + } +} catch ( exc ) { + alert( exc.message ); +} + diff --git a/src/template/tizen/config.xml.in b/src/template/tizen/config.xml.in index 002e7a9..d1aa3e3 100644 --- a/src/template/tizen/config.xml.in +++ b/src/template/tizen/config.xml.in @@ -27,5 +27,5 @@ - + -- 2.7.4