Created
July 17, 2014 13:20
-
-
Save skypanther/25f5a53c384780f9bb11 to your computer and use it in GitHub Desktop.
Android reorientation height/width
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ti sometimes determines platformWidth before, rather than after a | |
// reorientation. This works around that from @FokkeZB | |
if (OS_ANDROID) { | |
Alloy.Globals.platformWidth = Alloy.Globals.platformWidth / Alloy.Globals.density; | |
Alloy.Globals.platformHeight = Alloy.Globals.platformHeight / Alloy.Globals.density; | |
if (Ti.Gesture.landscape) { | |
console.info('switching!'); | |
var platformWidth = Alloy.Globals.platformWidth; | |
Alloy.Globals.platformWidth = Alloy.Globals.platformHeight; | |
Alloy.Globals.platformHeight = platformWidth; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment