本文整理汇总了Java中com.android.builder.model.ProductFlavorContainer.getProductFlavor方法的典型用法代码示例。如果您正苦于以下问题:Java ProductFlavorContainer.getProductFlavor方法的具体用法?Java ProductFlavorContainer.getProductFlavor怎么用?Java ProductFlavorContainer.getProductFlavor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.builder.model.ProductFlavorContainer
的用法示例。
在下文中一共展示了ProductFlavorContainer.getProductFlavor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAndroidSources
import com.android.builder.model.ProductFlavorContainer; //导入方法依赖的package包/类
private Map<String, Set<File>> getAndroidSources(ProductFlavorContainer defaultConfig) {
Map<String, Set<File>> sources = new HashMap<>();
ProductFlavor productFlavor = defaultConfig.getProductFlavor();
String name = productFlavor.getName();
SourceProvider sourceProvider = defaultConfig.getSourceProvider();
AndroidSupport.setAndroidSources(sources, sourceProvider, false);
// extra
Collection<SourceProviderContainer> extraSourceProviders =
defaultConfig.getExtraSourceProviders();
extraSourceProviders.forEach(
sourceProviderContainer -> {
String artifactName = sourceProviderContainer.getArtifactName();
SourceProvider provider = sourceProviderContainer.getSourceProvider();
boolean isTest = artifactName.contains(TEST_SUFFIX);
AndroidSupport.setAndroidSources(sources, provider, isTest);
});
return sources;
}
示例2: addResConfigsFromFlavor
import com.android.builder.model.ProductFlavorContainer; //导入方法依赖的package包/类
/**
* 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);
}
}
}
}
}
示例3: addResConfigsFromFlavor
import com.android.builder.model.ProductFlavorContainer; //导入方法依赖的package包/类
/**
* 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);
}
}
}
}
}