public class ScreenTools extends Object
| Constructor and Description |
|---|
ScreenTools() |
| Modifier and Type | Method and Description |
|---|---|
static DisplayMetrics |
getDisplayMetrics(Activity activity)
Returns the display metrics of the device, using the currently shown
Activity for
accessing the window manager. |
static int |
getScreenOrientation(Activity activity)
Returns the current orientation of the device.
|
static boolean |
haveBigScreen(Activity activity)
Checks if the device has a big screen using the currently shown
Activity for
accessing window manager in order to retrieve the device's DisplayMetrics. |
static boolean |
orientationIsLandscape(Activity activity)
Convenience method to quickly identify landscape-orientation
|
static boolean |
orientationIsPortrait(Activity activity)
Convenience method to quickly identify portrait-orientation
|
public static boolean haveBigScreen(Activity activity)
Checks if the device has a big screen using the currently shown Activity for
accessing window manager in order to retrieve the device's DisplayMetrics.
The decision whether is screen size is "big" or not depends on a couple of things. First of
all, it is checked whether Configuration.screenLayout is set to eiter large or
extra-large. Depending on this check, on of the following two things are checked:
If this evaluates to true, the screen is a big
one.
activity - The currently shown activity.public static DisplayMetrics getDisplayMetrics(Activity activity)
Activity for
accessing the window manager.activity - The currently shown Activity.DisplayMetrics of the device.public static int getScreenOrientation(Activity activity)
activity - The currently shown activitypublic static boolean orientationIsLandscape(Activity activity)
activity - The currently shown activitypublic static boolean orientationIsPortrait(Activity activity)
activity - The currently shown activity