Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5205A200BEB for ; Wed, 14 Dec 2016 00:48:31 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 50B6A160B31; Tue, 13 Dec 2016 23:48:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 73657160B32 for ; Wed, 14 Dec 2016 00:48:30 +0100 (CET) Received: (qmail 29728 invoked by uid 500); 13 Dec 2016 23:48:29 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 29702 invoked by uid 99); 13 Dec 2016 23:48:29 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Dec 2016 23:48:29 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 80610E95B8; Tue, 13 Dec 2016 23:48:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: purplecabbage@apache.org To: commits@cordova.apache.org Date: Tue, 13 Dec 2016 23:48:32 -0000 Message-Id: <96da49a062334a59acc33b42479359a0@git.apache.org> In-Reply-To: <4853e020448a4bacbe9b65cbbe3736ae@git.apache.org> References: <4853e020448a4bacbe9b65cbbe3736ae@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/16] cordova-plugin-screen-orientation git commit: changed orientation spec and modified Readme archived-at: Tue, 13 Dec 2016 23:48:31 -0000 changed orientation spec and modified Readme Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/commit/c00a7c4b Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/tree/c00a7c4b Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/diff/c00a7c4b Branch: refs/heads/master Commit: c00a7c4b8546694b8fd96f119a2c845bc13e2c71 Parents: 86a9c81 Author: maverickmishra Authored: Tue Aug 30 17:11:10 2016 -0700 Committer: maverickmishra Committed: Tue Aug 30 17:11:10 2016 -0700 ---------------------------------------------------------------------- README.md | 32 ++++++-------------------------- src/android/CDVOrientation.java | 5 ++--- www/screenorientation.js | 10 +++++----- 3 files changed, 13 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/blob/c00a7c4b/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index 9cd5d8c..af4b755 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,9 @@ cordova plugin add cordova-plugin-screen-orientation #### landscape > The orientation is either landscape-primary or landscape-secondary (sensor). +#### any +> orientation is landscape-primary or landscape-secondary (sensor). + ## Usage ```js @@ -101,38 +104,15 @@ window.addEventListener("orientationchange", function(){ The __screen.orientation__ property will not update when the phone is [rotated 180 degrees](http://www.quirksmode.org/dom/events/orientationchange.html). -## iOS Notes - -The iOS version is a combination of the cordova JS callback _window.shouldRotateToOrientation_ and the workaround to recheck the orientation as implemented in https://github.com/Adlotto/cordova-plugin-recheck-screen-orientation. - -__If you have a custom implementation of the _window.shouldRotateToOrientation_ it will have to be removed for the plugin to function as expected.__ - -#### iOS6 - -There has been a few cases where the rotation does not change the width of the viewport - -Issue [#1](https://github.com/gbenvenuti/cordova-plugin-screen-orientation/issues/1) @dokterbob - ->It seems to be related to having width=device-width, height=device-height in the meta viewport (which is part of the boilerplate phonegap/cordova app). It can be solved by updating the viewport with width=device-height, height=device-width or simply removing width and height altogether. - -#### iOS8 - -Versions prior to 1.2.0 will cause an application crash in iOS8 due to a change in presentViewController timing. - ## BB10 Notes Wraps the com.blackberry.app plugin functions, auto installed as a dependancy. -## WP8 Notes - -Windows phone does not support specification or primary and secondary orientations. If called with a specific orientation the plugin will just apply the landscape or portait orientation. - -## W8.1 Notes - -Windows 8.1 Applicaitons (runtime/metro applications) will only display orientation changes if the device has some sort of accelerometer. The internal state of the "orientation" will still be kept, but the actual screen won't rotate unless the device supports it. - # Changelog +## 2.0 +* Common javascript for iOS, Android and Windows. + ## 1.4.2 * [#101](https://github.com/gbenvenuti/cordova-plugin-screen-orientation/pull/101) make iOS rotate as needed when lockOrientation is called http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/blob/c00a7c4b/src/android/CDVOrientation.java ---------------------------------------------------------------------- diff --git a/src/android/CDVOrientation.java b/src/android/CDVOrientation.java index 3def795..c7dc207 100644 --- a/src/android/CDVOrientation.java +++ b/src/android/CDVOrientation.java @@ -33,13 +33,12 @@ import android.util.Log; public class CDVOrientation extends CordovaPlugin { - private static final String TAG = "YoikScreenOrientation"; /** * Screen Orientation Constants */ - private static final String UNLOCKED = "unlocked"; + private static final String ANY = "any"; private static final String PORTRAIT_PRIMARY = "portrait-primary"; private static final String PORTRAIT_SECONDARY = "portrait-secondary"; private static final String LANDSCAPE_PRIMARY = "landscape-primary"; @@ -74,7 +73,7 @@ public class CDVOrientation extends CordovaPlugin { Activity activity = cordova.getActivity(); - if (orientation.equals(UNLOCKED)) { + if (orientation.equals(ANY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else if (orientation.equals(LANDSCAPE_PRIMARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/blob/c00a7c4b/www/screenorientation.js ---------------------------------------------------------------------- diff --git a/www/screenorientation.js b/www/screenorientation.js index ac468f7..77f1f9f 100644 --- a/www/screenorientation.js +++ b/www/screenorientation.js @@ -36,7 +36,7 @@ ]; screenOrientation.Orientations = Orientations; - screenOrientation.currOrientation = 'natural'; + screenOrientation.currOrientation = 'any'; var orientationMask = 0; screenOrientation.setOrientation = function(orientation) { if(orientation == 'portrait-primary'){ @@ -57,7 +57,7 @@ else if(orientation == 'landscape'){ orientationMask = 12; } - else if(orientation == 'natural'){ + else if(orientation == 'any'){ orientationMask = 15; } @@ -81,8 +81,8 @@ }; screenObject.unlockOrientation = function() { - screenOrientation.currOrientation = screenObject.orientation = 'natural'; - screenOrientation.setOrientation('natural'); + screenOrientation.currOrientation = screenObject.orientation = 'any'; + screenOrientation.setOrientation('any'); }; } @@ -106,7 +106,7 @@ orientation = 'landscape-secondary'; break; default: - orientation = 'unknown'; + orientation = 'any'; } screen.orientation = orientation; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org