public class AndroidUtil
extends java.lang.Object
This should not be confused with the global state of the device (see DeviceUtil)
The main purpose of this class is to share common operations related to the application state, so caller may use this abstraction instead of directly looking into android internals.
Moreover, this abstraction allow tests to stub those android specific parts.
| Constructor and Description |
|---|
AndroidUtil(android.content.Context context,
DeviceUtil deviceUtil) |
| Modifier and Type | Method and Description |
|---|---|
int |
dpToPixel(int dp)
Transform given distance in DP (density-independent pixel) into pixels.
|
int |
getOrientation()
Overall orientation of the screen.
|
public AndroidUtil(@NonNull
android.content.Context context,
@NonNull
DeviceUtil deviceUtil)
public int getOrientation()
May be one of Configuration.ORIENTATION_LANDSCAPE, Configuration.ORIENTATION_PORTRAIT.
public int dpToPixel(int dp)
dp - distance in DP