Java Code Examples for android.os.LocaleList#forLanguageTags()
The following examples show how to use
android.os.LocaleList#forLanguageTags() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InputManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@NonNull private static LocaleList getLocalesFromLanguageTags(String languageTags) { if (TextUtils.isEmpty(languageTags)) { return LocaleList.getEmptyLocaleList(); } return LocaleList.forLanguageTags(languageTags.replace('|', ',')); }
Example 2
Source File: Configuration.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
/** * Reads the attributes corresponding to Configuration member fields from the Xml parser. * The parser is expected to be on a tag which has Configuration attributes. * * @param parser The Xml parser from which to read attributes. * @param configOut The Configuration to populate from the Xml attributes. * {@hide} */ public static void readXmlAttrs(XmlPullParser parser, Configuration configOut) throws XmlPullParserException, IOException { configOut.fontScale = Float.intBitsToFloat( XmlUtils.readIntAttribute(parser, XML_ATTR_FONT_SCALE, 0)); configOut.mcc = XmlUtils.readIntAttribute(parser, XML_ATTR_MCC, 0); configOut.mnc = XmlUtils.readIntAttribute(parser, XML_ATTR_MNC, 0); final String localesStr = XmlUtils.readStringAttribute(parser, XML_ATTR_LOCALES); configOut.mLocaleList = LocaleList.forLanguageTags(localesStr); configOut.locale = configOut.mLocaleList.get(0); configOut.touchscreen = XmlUtils.readIntAttribute(parser, XML_ATTR_TOUCHSCREEN, TOUCHSCREEN_UNDEFINED); configOut.keyboard = XmlUtils.readIntAttribute(parser, XML_ATTR_KEYBOARD, KEYBOARD_UNDEFINED); configOut.keyboardHidden = XmlUtils.readIntAttribute(parser, XML_ATTR_KEYBOARD_HIDDEN, KEYBOARDHIDDEN_UNDEFINED); configOut.hardKeyboardHidden = XmlUtils.readIntAttribute(parser, XML_ATTR_HARD_KEYBOARD_HIDDEN, HARDKEYBOARDHIDDEN_UNDEFINED); configOut.navigation = XmlUtils.readIntAttribute(parser, XML_ATTR_NAVIGATION, NAVIGATION_UNDEFINED); configOut.navigationHidden = XmlUtils.readIntAttribute(parser, XML_ATTR_NAVIGATION_HIDDEN, NAVIGATIONHIDDEN_UNDEFINED); configOut.orientation = XmlUtils.readIntAttribute(parser, XML_ATTR_ORIENTATION, ORIENTATION_UNDEFINED); configOut.screenLayout = XmlUtils.readIntAttribute(parser, XML_ATTR_SCREEN_LAYOUT, SCREENLAYOUT_UNDEFINED); configOut.colorMode = XmlUtils.readIntAttribute(parser, XML_ATTR_COLOR_MODE, COLOR_MODE_UNDEFINED); configOut.uiMode = XmlUtils.readIntAttribute(parser, XML_ATTR_UI_MODE, 0); configOut.screenWidthDp = XmlUtils.readIntAttribute(parser, XML_ATTR_SCREEN_WIDTH, SCREEN_WIDTH_DP_UNDEFINED); configOut.screenHeightDp = XmlUtils.readIntAttribute(parser, XML_ATTR_SCREEN_HEIGHT, SCREEN_HEIGHT_DP_UNDEFINED); configOut.smallestScreenWidthDp = XmlUtils.readIntAttribute(parser, XML_ATTR_SMALLEST_WIDTH, SMALLEST_SCREEN_WIDTH_DP_UNDEFINED); configOut.densityDpi = XmlUtils.readIntAttribute(parser, XML_ATTR_DENSITY, DENSITY_DPI_UNDEFINED); // For persistence, we don't care about assetsSeq and WindowConfiguration, so do not read it // out. }
Example 3
Source File: LocaleUtils.java From prayer-times-android with Apache License 2.0 | 4 votes |
@RequiresApi(api = Build.VERSION_CODES.N) @NonNull public static LocaleList getLocales() { return LocaleList.forLanguageTags(getLocalesCompat().toLanguageTags()); }
Example 4
Source File: LocaleUtils.java From prayer-times-android with Apache License 2.0 | 4 votes |
@RequiresApi(api = Build.VERSION_CODES.N) @NonNull public static LocaleList getLocales() { return LocaleList.forLanguageTags(getLocalesCompat().toLanguageTags()); }