当前位置: 首页>>代码示例>>Java>>正文


Java LocaleList.size方法代码示例

本文整理汇总了Java中android.os.LocaleList.size方法的典型用法代码示例。如果您正苦于以下问题:Java LocaleList.size方法的具体用法?Java LocaleList.size怎么用?Java LocaleList.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.LocaleList的用法示例。


在下文中一共展示了LocaleList.size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDefault

import android.os.LocaleList; //导入方法依赖的package包/类
public static List<Locale> getDefault(Context context, boolean getAllIfPossible) {
    List<Locale> list = new ArrayList();
    if (VERSION.SDK_INT >= 24) {
        LocaleList locales = context.getResources().getConfiguration().getLocales();
        for (int i = 0; i < locales.size(); i++) {
            Locale locale = locales.get(i);
            if (!getAllIfPossible) {
                list.add(locale);
                break;
            }
            list.add(locale);
        }
    } else {
        list.add(context.getResources().getConfiguration().locale);
    }
    return list;
}
 
开发者ID:mrprona92,项目名称:SecretBrand,代码行数:18,代码来源:LocaleUtils.java

示例2: AlphabeticIndexVN

import android.os.LocaleList; //导入方法依赖的package包/类
AlphabeticIndexVN(Context context) {
    LocaleList locales = context.getResources().getConfiguration().getLocales();
    int localeCount = locales.size();

    Locale primaryLocale = localeCount == 0 ? Locale.ENGLISH : locales.get(0);
    AlphabeticIndex indexBuilder = new AlphabeticIndex(primaryLocale);
    for (int i = 1; i < localeCount; i++) {
        indexBuilder.addLabels(locales.get(i));
    }
    indexBuilder.addLabels(Locale.ENGLISH);

    mAlphabeticIndex = indexBuilder.buildImmutableIndex();
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:14,代码来源:AlphabeticIndexCompat.java

示例3: mapToListOfLocales

import android.os.LocaleList; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.N)
private static List<Locale> mapToListOfLocales(LocaleList localeList) {
    List<Locale> locales = new ArrayList<>();
    for (int i = 0; i < localeList.size(); i++) {
        locales.add(localeList.get(i));
    }
    return locales;
}
 
开发者ID:franmontiel,项目名称:LocaleChanger,代码行数:9,代码来源:SystemLocaleRetriever.java

示例4: AlphabeticIndexVN

import android.os.LocaleList; //导入方法依赖的package包/类
public AlphabeticIndexVN(Context context) {
    LocaleList locales = context.getResources().getConfiguration().getLocales();
    int localeCount = locales.size();

    Locale primaryLocale = localeCount == 0 ? Locale.ENGLISH : locales.get(0);
    AlphabeticIndex indexBuilder = new AlphabeticIndex(primaryLocale);
    for (int i = 1; i < localeCount; i++) {
        indexBuilder.addLabels(locales.get(i));
    }
    indexBuilder.addLabels(Locale.ENGLISH);

    mAlphabeticIndex = indexBuilder.buildImmutableIndex();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:14,代码来源:AlphabeticIndexCompat.java

示例5: toLanguageTags

import android.os.LocaleList; //导入方法依赖的package包/类
/**
 * Converts LocaleList object to the comma separated BCP 47 compliant string format.
 *
 * @return a well-formed IETF BCP 47 language tag with language and country code that
 *         represents this locale list.
 */
@TargetApi(Build.VERSION_CODES.N)
public static String toLanguageTags(LocaleList localeList) {
    ArrayList<String> newLocaleList = new ArrayList<>();
    for (int i = 0; i < localeList.size(); i++) {
        Locale locale = getUpdatedLocaleForChromium(localeList.get(i));
        newLocaleList.add(toLanguageTag(locale));
    }
    return TextUtils.join(",", newLocaleList);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:16,代码来源:LocaleUtils.java

示例6: getLocale

import android.os.LocaleList; //导入方法依赖的package包/类
private Locale getLocale() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        LocaleList locales = getConfiguration().getLocales();
        if (locales.size() > 0) {
            return locales.get(0);
        }
    }
    return getConfiguration().locale;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:DateTimePickerDialog.java

示例7: list

import android.os.LocaleList; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.N)
private ArrayList<Locale> list(Configuration configuration) {
	ArrayList<Locale> arrayList = new ArrayList<>();
	if (C.API_NOUGAT) {
		LocaleList localeList = configuration.getLocales();
		for (int i = 0; i < localeList.size(); i++) {
			arrayList.add(localeList.get(i));
		}
	} else {
		arrayList.add(configuration.locale);
	}
	return arrayList;
}
 
开发者ID:Mishiranu,项目名称:Dashchan,代码行数:15,代码来源:LocaleManager.java


注:本文中的android.os.LocaleList.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。