Created
July 19, 2012 20:20
-
-
Save tonylukasavage/3146501 to your computer and use it in GitHub Desktop.
getSize() for Android in Titanium
This file contains hidden or 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
@Kroll.getProperty @Kroll.method | |
public String getSize() { | |
switch(TiApplication.getInstance().getApplicationContext().getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) { | |
case Configuration.SCREENLAYOUT_SIZE_SMALL : | |
return "small"; | |
case Configuration.SCREENLAYOUT_SIZE_NORMAL : | |
return "normal"; | |
case Configuration.SCREENLAYOUT_SIZE_LARGE : | |
return "large"; | |
case 4 : // Configuration.SCREENLAYOUT_SIZE_XLARGE (API 9) | |
return "xlarge"; | |
case Configuration.SCREENLAYOUT_SIZE_UNDEFINED: | |
default : | |
return "medium"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment