Search in sources :

Example 81 with Collator

use of android.icu.text.Collator in project android_packages_apps_Settings by omnirom.

the class RegionSearchPicker method createAdapterItem.

private List<RegionItem> createAdapterItem(Set<String> regionIds) {
    final Collator collator = Collator.getInstance(getLocale());
    final TreeSet<RegionItem> items = new TreeSet<>(new RegionInfoComparator(collator));
    final LocaleDisplayNames localeDisplayNames = LocaleDisplayNames.getInstance(getLocale());
    long i = 0;
    for (String regionId : regionIds) {
        String name = localeDisplayNames.regionDisplayName(regionId);
        items.add(new RegionItem(i++, regionId, name));
    }
    return new ArrayList<>(items);
}
Also used : TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) Collator(android.icu.text.Collator) LocaleDisplayNames(android.icu.text.LocaleDisplayNames)

Aggregations

Collator (android.icu.text.Collator)81 Test (org.junit.Test)72 RuleBasedCollator (android.icu.text.RuleBasedCollator)70 Locale (java.util.Locale)25 ULocale (android.icu.util.ULocale)22 CollationKey (android.icu.text.CollationKey)15 MissingResourceException (java.util.MissingResourceException)11 RawCollationKey (android.icu.text.RawCollationKey)7 ParseException (java.text.ParseException)6 Random (java.util.Random)6 BreakIterator (android.icu.text.BreakIterator)5 StringCharacterIterator (java.text.StringCharacterIterator)5 LocaleDisplayNames (android.icu.text.LocaleDisplayNames)4 StringSearch (android.icu.text.StringSearch)4 CollationElementIterator (android.icu.text.CollationElementIterator)3 ArrayList (java.util.ArrayList)3 UnicodeSet (android.icu.text.UnicodeSet)2 GlobalizationPreferences (android.icu.util.GlobalizationPreferences)2 HashSet (java.util.HashSet)2 TreeSet (java.util.TreeSet)2