List of usage examples for android.content.res Resources getSystem
public static Resources getSystem()
From source file:Main.java
public static float density() { return Resources.getSystem().getDisplayMetrics().density; }
From source file:Main.java
public static int dp(int val) { return (int) (Resources.getSystem().getDisplayMetrics().density * val); }
From source file:Main.java
public static int getScreenHeight() { return Resources.getSystem().getDisplayMetrics().heightPixels; }
From source file:Main.java
public static float pxToSp(float px) { return (px / Resources.getSystem().getDisplayMetrics().scaledDensity); }
From source file:Main.java
public static float pxToDp(float px) { return (px / Resources.getSystem().getDisplayMetrics().density); }
From source file:Main.java
public static float spToPx(float sp) { return (sp * Resources.getSystem().getDisplayMetrics().scaledDensity); }
From source file:Main.java
public static int getStatusBarHeight() { return Resources.getSystem().getDimensionPixelSize( Resources.getSystem().getIdentifier("status_bar_height", "dimen", "android")); }
From source file:Main.java
public static int spToPx(int sp) { return (int) (sp * Resources.getSystem().getDisplayMetrics().scaledDensity); }
From source file:Main.java
public static int pxToSp(int px) { return (int) (px / Resources.getSystem().getDisplayMetrics().scaledDensity); }
From source file:Main.java
public static int pxToDp(int px) { return (int) (px / Resources.getSystem().getDisplayMetrics().density); }