Java Code Examples for com.android.builder.model.ProductFlavor#getResourceConfigurations()

The following examples show how to use com.android.builder.model.ProductFlavor#getResourceConfigurations() . 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: Project.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Adds in the resConfig values specified by the given flavor container, assuming
 * it's in one of the relevant variantFlavors, into the given set
 */
private static void addResConfigsFromFlavor(@NonNull Set<String> relevantDensities,
        @Nullable List<String> variantFlavors,
        @NonNull ProductFlavorContainer container) {
    ProductFlavor flavor = container.getProductFlavor();
    if (variantFlavors == null || variantFlavors.contains(flavor.getName())) {
        if (!flavor.getResourceConfigurations().isEmpty()) {
            for (String densityName : flavor.getResourceConfigurations()) {
                Density density = Density.getEnum(densityName);
                if (density != null && density.isRecommended()
                        && density != Density.NODPI && density != Density.ANYDPI) {
                    relevantDensities.add(densityName);
                }
            }
        }
    }
}
 
Example 2
Source File: IconDetector.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Adds in the resConfig values specified by the given flavor container, assuming
 * it's in one of the relevant variantFlavors, into the given set
 */
private static void addResConfigsFromFlavor(@NonNull Set<String> relevantDensities,
                                            @Nullable List<String> variantFlavors,
                                            @NonNull ProductFlavorContainer container) {
    ProductFlavor flavor = container.getProductFlavor();
    if (variantFlavors == null || variantFlavors.contains(flavor.getName())) {
        if (!flavor.getResourceConfigurations().isEmpty()) {
            for (String densityName : flavor.getResourceConfigurations()) {
                Density density = Density.getEnum(densityName);
                if (density != null && density.isRecommended()
                        && density != Density.NODPI && density != Density.ANYDPI) {
                    relevantDensities.add(densityName);
                }
            }
        }
    }
}
 
Example 3
Source File: TranslationDetector.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Adds in the resConfig values specified by the given flavor container, assuming
 * it's in one of the relevant variantFlavors, into the given set
 */
private static void addResConfigsFromFlavor(@NonNull Set<String> relevantLanguages,
        @Nullable List<String> variantFlavors,
        @NonNull ProductFlavorContainer container) {
    ProductFlavor flavor = container.getProductFlavor();
    if (variantFlavors == null || variantFlavors.contains(flavor.getName())) {
        if (!flavor.getResourceConfigurations().isEmpty()) {
            for (String resConfig : flavor.getResourceConfigurations()) {
                // Look for languages; these are of length 2. (ResConfigs
                // can also refer to densities, etc.)
                if (resConfig.length() == 2) {
                    relevantLanguages.add(resConfig);
                }
            }
        }
    }
}