This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4bab9fa  fix BrowserOrientation in Android when open virtual keyboard
4bab9fa is described below

commit 4bab9fa86d32b14e37563e2211b1dc05c50a5d84
Author: Carlos Rovira <[email protected]>
AuthorDate: Sun Feb 17 19:20:02 2019 +0100

    fix BrowserOrientation in Android when open virtual keyboard
---
 .../org/apache/royale/core/BrowserOrientation.as     | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserOrientation.as
 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserOrientation.as
index f842ecc..713fe4b 100644
--- 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserOrientation.as
+++ 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserOrientation.as
@@ -116,11 +116,23 @@ COMPILE::JS
                 var outerWidth:Number = 
document.body.getBoundingClientRect().width;
                 var outerHeight:Number = 
document.body.getBoundingClientRect().height;
                 
-                if (orientation != PORTRAIT && outerHeight > outerWidth) {
-                    orientation = PORTRAIT;
-                } else if (orientation != LANDSCAPE && outerHeight < 
outerWidth) {
-                    orientation = LANDSCAPE;
+                if(OSUtils.getOS() == OSUtils.IOS_OS)
+                {
+                    if (orientation != PORTRAIT && outerHeight > outerWidth) {
+                        orientation = PORTRAIT;
+                    } else if (orientation != LANDSCAPE && outerHeight < 
outerWidth) {
+                        orientation = LANDSCAPE;
+                    }
+                } else if(OSUtils.getOS() == OSUtils.ANDROID_OS)
+                {
+                    if(orientation != PORTRAIT && 
screen.orientation.type.indexOf("portrait") != -1 )
+                    {
+                        orientation = PORTRAIT;
+                    } else if (orientation != LANDSCAPE && 
screen.orientation.type.indexOf("landscape") != -1) {
+                        orientation = LANDSCAPE;
+                    }
                 }
+                
             }
         }
        }

Reply via email to