List of usage examples for android.content Context getResources
public abstract Resources getResources();
From source file:Main.java
public static int getResStyle(Context paramContext, String paramString) { return paramContext.getResources().getIdentifier(paramString, "style", paramContext.getPackageName()); }
From source file:Main.java
public static float sp2px(Context context, float sp) { final float scale = context.getResources().getDisplayMetrics().scaledDensity; return sp * scale; }
From source file:Main.java
public static int getResStr(Context paramContext, String paramString) { return paramContext.getResources().getIdentifier(paramString, "string", paramContext.getPackageName()); }
From source file:Main.java
public static int getResClo(Context paramContext, String paramString) { return paramContext.getResources().getIdentifier(paramString, "color", paramContext.getPackageName()); }
From source file:Main.java
public static int getResDraw(Context paramContext, String paramString) { return paramContext.getResources().getIdentifier(paramString, "drawable", paramContext.getPackageName()); }
From source file:Main.java
public static int dp2px(Context mContext, float dp) { final float scale = mContext.getResources().getDisplayMetrics().density; return (int) (dp * scale + 0.5f); }
From source file:Main.java
public static double px2Dp(Context context, float px) { final float scale = context.getResources().getDisplayMetrics().density; return px / scale + 0.5; }
From source file:Main.java
public static int Px2Dp(Context context, float px) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (px / scale + 0.5f); }
From source file:Main.java
public static int sp2px(Context context, float spValue) { float scale = context.getResources().getDisplayMetrics().scaledDensity; return (int) (spValue * scale + 0.5f); }
From source file:Main.java
public static int getDrawableIdByName(Context context, String drawableName) { return context.getResources().getIdentifier(drawableName, "drawable", context.getPackageName()); }