List of usage examples for android.content Context getResources
public abstract Resources getResources();
From source file:Main.java
public static int getScreenSize(Context context) { return context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK; }
From source file:Main.java
public static int getLanguage(Context context) { return context.getResources().getConfiguration().locale.getCountry().equals("CN") ? 1 : (context.getResources().getConfiguration().locale.getCountry().equals("TW") ? 2 : (context.getResources().getConfiguration().locale.getCountry().equals("US") ? 3 : 1)); }
From source file:Main.java
public static String getCurCountryLan(Context context) { return context.getResources().getConfiguration().locale.getLanguage() + "-" + context.getResources().getConfiguration().locale.getCountry(); }
From source file:Main.java
public static boolean isScreenPortrait(Context context) { return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; }
From source file:Main.java
public static boolean isLandScape(Context context) { return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; }
From source file:Main.java
public static int getScreenWidth(Context mContext) { return mContext.getResources().getDisplayMetrics().widthPixels; }
From source file:Main.java
public static boolean isTablet(Context context) { return (context.getResources().getConfiguration().screenLayout & 15) >= 3; }
From source file:Main.java
public static float displayDensity(Context paramContext) { return paramContext.getResources().getDisplayMetrics().density; }
From source file:Main.java
public static float dpFromPx(int px, Context context) { return px / context.getResources().getDisplayMetrics().density; }
From source file:Main.java
public static float pxFromDp(int dp, Context context) { return dp * context.getResources().getDisplayMetrics().density; }