android.os.LocaleList#forLanguageTags ( )源码实例Demo

下面列出了android.os.LocaleList#forLanguageTags ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android_9.0.0_r45   文件: InputManagerService.java
@NonNull
private static LocaleList getLocalesFromLanguageTags(String languageTags) {
    if (TextUtils.isEmpty(languageTags)) {
        return LocaleList.getEmptyLocaleList();
    }
    return LocaleList.forLanguageTags(languageTags.replace('|', ','));
}
 
源代码2 项目: android_9.0.0_r45   文件: Configuration.java
/**
 * 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.
}
 
源代码3 项目: prayer-times-android   文件: LocaleUtils.java
@RequiresApi(api = Build.VERSION_CODES.N)
@NonNull
public static LocaleList getLocales() {
    return LocaleList.forLanguageTags(getLocalesCompat().toLanguageTags());
}
 
源代码4 项目: prayer-times-android   文件: LocaleUtils.java
@RequiresApi(api = Build.VERSION_CODES.N)
@NonNull
public static LocaleList getLocales() {
    return LocaleList.forLanguageTags(getLocalesCompat().toLanguageTags());
}