List of usage examples for android.content.res Resources getConfiguration
public Configuration getConfiguration()
From source file:com.chen.mail.browse.SendersView.java
static String getMe(Context context) { final Resources resources = context.getResources(); final Locale locale = resources.getConfiguration().locale; if (sMeString == null || !locale.equals(sMeStringLocale)) { sMeString = resources.getString(R.string.me_subject_pronun); sMeStringLocale = locale;/* www . ja v a 2 s .com*/ } return sMeString; }
From source file:com.google.android.gms.common.C0270e.java
private static boolean m3396b(Resources resources) { Configuration configuration = resources.getConfiguration(); return C0519x.m4173b() && (configuration.screenLayout & 15) <= 3 && configuration.smallestScreenWidthDp >= 600; }
From source file:com.google.android.gms.common.internal.zzt.java
private static String a(final Context context, String s, final String s2) { final Resources resources = context.getResources(); String s3;//from w ww . j a v a 2 s . c om s = (s3 = a(context, s)); if (s == null) { s3 = resources.getString(R$string.common_google_play_services_unknown_issue); } return String.format(resources.getConfiguration().locale, s3, s2); }
From source file:org.bottiger.podcast.utils.UIUtils.java
public static int NavigationBarHeight(Context context) { Resources resources = context.getResources(); int orientation = resources.getConfiguration().orientation; int id = resources.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "android"); if (id > 0) { return resources.getDimensionPixelSize(id); }/*from w w w . ja va2 s .co m*/ return 0; }
From source file:com.adjust.sdk.Util.java
protected static String getUserAgent(final Context context) { final Resources resources = context.getResources(); final DisplayMetrics displayMetrics = resources.getDisplayMetrics(); final Configuration configuration = resources.getConfiguration(); final Locale locale = configuration.locale; final int screenLayout = configuration.screenLayout; final String[] parts = { getPackageName(context), getAppVersion(context), getDeviceType(screenLayout), getDeviceName(), getOsName(), getOsVersion(), getLanguage(locale), getCountry(locale), getScreenSize(screenLayout), getScreenFormat(screenLayout), getScreenDensity(displayMetrics), getDisplayWidth(displayMetrics), getDisplayHeight(displayMetrics) }; return TextUtils.join(" ", parts); }
From source file:me.zhang.bingo.Utility.java
public static void applyAppLanguage(Context context) { Locale myLocale = Utility.getChoosedLocale(context); Resources res = context.getResources(); DisplayMetrics dm = res.getDisplayMetrics(); Configuration conf = res.getConfiguration(); conf.locale = myLocale;//w w w . j a v a2 s. c om res.updateConfiguration(conf, dm); }
From source file:com.google.android.gms.common.C0270e.java
public static boolean m3390a(Resources resources) { if (resources == null) { return false; }/*from ww w.j a va 2 s . c o m*/ return (C0519x.m4171a() && ((resources.getConfiguration().screenLayout & 15) > 3)) || C0270e.m3396b(resources); }
From source file:com.google.android.gms.common.GooglePlayServicesUtil.java
private static boolean m112b(Resources resources) { Configuration configuration = resources.getConfiguration(); return gr.fw() && (configuration.screenLayout & 15) <= 3 && configuration.smallestScreenWidthDp >= 600; }
From source file:com.bilibili.magicasakura.utils.ThemeUtils.java
public static Resources updateNightMode(Resources resource, boolean on) { DisplayMetrics dm = resource.getDisplayMetrics(); Configuration config = resource.getConfiguration(); final int uiModeNightMaskOrigin = config.uiMode &= ~Configuration.UI_MODE_TYPE_MASK; final int uiModeNightMaskNew = on ? Configuration.UI_MODE_NIGHT_YES : Configuration.UI_MODE_NIGHT_NO; if (uiModeNightMaskOrigin != uiModeNightMaskNew) { config.uiMode &= ~Configuration.UI_MODE_NIGHT_MASK; config.uiMode |= uiModeNightMaskNew; resource.updateConfiguration(config, dm); }/*from ww w . j a v a 2 s.co m*/ return resource; }
From source file:Main.java
public static void setLocale(String lang, Resources res) { Locale myLocale;//from ww w. j av a 2 s.co m if (lang.equalsIgnoreCase("zh-rTW")) { myLocale = Locale.TRADITIONAL_CHINESE; } else if (lang.equalsIgnoreCase("zh-rCN") || lang.equalsIgnoreCase("zh")) { myLocale = Locale.SIMPLIFIED_CHINESE; } else if (lang.equalsIgnoreCase("pt-rBR") || lang.equalsIgnoreCase("pt")) { myLocale = new Locale("pt", "BR"); } else if (lang.equalsIgnoreCase("pt-rPT")) { myLocale = new Locale("pt", "PT"); } else { myLocale = new Locale(lang); } DisplayMetrics dm = res.getDisplayMetrics(); Configuration conf = res.getConfiguration(); conf.locale = myLocale; res.updateConfiguration(conf, dm); }