Skip to content

Instantly share code, notes, and snippets.

@skypanther
Created July 17, 2014 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skypanther/25f5a53c384780f9bb11 to your computer and use it in GitHub Desktop.
Save skypanther/25f5a53c384780f9bb11 to your computer and use it in GitHub Desktop.
Android reorientation height/width
// 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