List of usage examples for android.content Context getResources
public abstract Resources getResources();
From source file:Main.java
public static float px2sp(Context context, float pxVal) { return (pxVal / context.getResources().getDisplayMetrics().scaledDensity); }
From source file:Main.java
public static int getHeigth(Context context) { int screenHeight = context.getResources().getDisplayMetrics().heightPixels; return screenHeight; }
From source file:Main.java
public static int getSpOfRes(Context context, @DimenRes int res) { return context.getResources().getDimensionPixelSize(res); }
From source file:Main.java
public static final boolean getBool(final Context context, final int resId) { return context.getResources().getBoolean(resId); }
From source file:Main.java
public static int getDpOfRes(Context context, @DimenRes int res) { return context.getResources().getDimensionPixelOffset(res); }
From source file:Main.java
public static int dp2px(Context context, float dp) { return (int) (dp * context.getResources().getDisplayMetrics().density + 0.5f); }
From source file:Main.java
public static DisplayMetrics getScreenInfo(Context context) { Resources resources = context.getResources(); DisplayMetrics dm = resources.getDisplayMetrics(); return dm;//from w ww. j a v a2 s. c o m }
From source file:Main.java
public static int getDisplayWidth(Context context) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); return metrics.widthPixels; }
From source file:Main.java
public static float pxTosp(Context context, float pxVal) { return (pxVal / context.getResources().getDisplayMetrics().scaledDensity); }
From source file:Main.java
public static int getColorOfRes(Context context, @ColorRes int res) { return context.getResources().getColor(res); }