List of usage examples for android.util TypedValue applyDimension
public static float applyDimension(int unit, float value, DisplayMetrics metrics)
From source file:Main.java
static int dp(float dp, DisplayMetrics metrics) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, metrics); }
From source file:Main.java
private static int dpToPx(Context context, int dp) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics()); }
From source file:Main.java
public static float dip2px(Context context, float value) { return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, context.getResources().getDisplayMetrics()); }
From source file:Main.java
public static int dp2px(Context context, float dpVal) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpVal, getDM(context)); }
From source file:Main.java
public static float getPixelsFromDp(Context context, int dp) { return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics()); }
From source file:Main.java
public static float dpToPx(Context context, float dp) { return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics()) + 0.5f; }
From source file:Main.java
public static int pxToDp(int px, Context context) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, px, context.getResources().getDisplayMetrics()); }
From source file:Main.java
public static int getDimensionSize(int size) { return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, size, Resources.getSystem().getDisplayMetrics())); }
From source file:Main.java
public static int spToPx(Context context, int spValue) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spValue, context.getResources().getDisplayMetrics()); }
From source file:Main.java
public static int dpToPx(Context context, int dp) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics()); }