List of usage examples for android.content Context getResources
public abstract Resources getResources();
From source file:Main.java
public static boolean isOrientationPortrait(Context context) { if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { return true; }//w w w . j a v a2 s.c om return false; }
From source file:Main.java
public static float getDisplayDensity(Context context) { return context.getResources().getDisplayMetrics().density; }
From source file:Main.java
public static boolean isOrientationLandscape(Context context) { if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { return true; }//from www . ja va 2 s . c om return false; }
From source file:Main.java
public static float densityScale(Context context) { return (context.getResources().getDisplayMetrics().density); }
From source file:Main.java
public static void init(Context context) { metrics = context.getResources().getDisplayMetrics(); }
From source file:Main.java
public static float getScreenDensity(Context context) { return context.getResources().getDisplayMetrics().density; }
From source file:Main.java
public static DisplayMetrics getDM(Context context) { return context.getResources().getDisplayMetrics(); }
From source file:Main.java
public static float dpToPx(float dp, Context context) { return dp * context.getResources().getDisplayMetrics().density; }
From source file:Main.java
public static boolean isPortrait(Context context) { return context.getResources().getDisplayMetrics().widthPixels < context.getResources() .getDisplayMetrics().heightPixels; }
From source file:Main.java
private static DisplayMetrics getScreenMetrics(Context context) { return context.getResources().getDisplayMetrics(); }