Java Code Examples for com.android.ide.common.resources.configuration.FolderConfiguration#getLanguageQualifier()

The following examples show how to use com.android.ide.common.resources.configuration.FolderConfiguration#getLanguageQualifier() . 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: ResourceRepository.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the sorted list of languages used in the resources.
 */
@NonNull
public SortedSet<String> getLanguages() {
    ensureInitialized();

    SortedSet<String> set = new TreeSet<String>();

    Collection<List<ResourceFolder>> folderList = mFolderMap.values();
    for (List<ResourceFolder> folderSubList : folderList) {
        for (ResourceFolder folder : folderSubList) {
            FolderConfiguration config = folder.getConfiguration();
            LanguageQualifier lang = config.getLanguageQualifier();
            if (lang != null) {
                set.add(lang.getShortDisplayValue());
            }
        }
    }

    return set;
}
 
Example 2
Source File: ResourceRepository.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the sorted list of regions used in the resources with the given language.
 * @param currentLanguage the current language the region must be associated with.
 */
@NonNull
public SortedSet<String> getRegions(@NonNull String currentLanguage) {
    ensureInitialized();

    SortedSet<String> set = new TreeSet<String>();

    Collection<List<ResourceFolder>> folderList = mFolderMap.values();
    for (List<ResourceFolder> folderSubList : folderList) {
        for (ResourceFolder folder : folderSubList) {
            FolderConfiguration config = folder.getConfiguration();

            // get the language
            LanguageQualifier lang = config.getLanguageQualifier();
            if (lang != null && lang.getShortDisplayValue().equals(currentLanguage)) {
                RegionQualifier region = config.getRegionQualifier();
                if (region != null) {
                    set.add(region.getShortDisplayValue());
                }
            }
        }
    }

    return set;
}