public class ResourceFilters extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ResourceFilters.Density
Represents the names and values of valid densities for resources as defined in
http://developer.android.com/guide/topics/resources/providing-resources.html#DensityQualifier
|
static class |
ResourceFilters.Qualifiers |
Modifier and Type | Field and Description |
---|---|
static com.google.common.collect.ImmutableSet<String> |
SUPPORTED_RESOURCE_DIRECTORIES
The set of supported directories in resource folders.
|
Modifier and Type | Method and Description |
---|---|
static java.util.function.Predicate<Path> |
createDensityFilter(ProjectFilesystem filesystem,
Set<ResourceFilters.Density> targetDensities)
Given a set of target densities, returns a
Predicate that fails for any non-drawable
resource of a different density. |
static java.util.function.Predicate<Path> |
createImageDensityFilter(Collection<Path> candidates,
Set<ResourceFilters.Density> targetDensities,
boolean canDownscale)
Given a list of paths of available drawables, and a target screen density, returns a
Predicate that fails for drawables of a different density, whenever
they can be safely removed. |
public static final com.google.common.collect.ImmutableSet<String> SUPPORTED_RESOURCE_DIRECTORIES
public static java.util.function.Predicate<Path> createImageDensityFilter(Collection<Path> candidates, Set<ResourceFilters.Density> targetDensities, boolean canDownscale)
Predicate
that fails for drawables of a different density, whenever
they can be safely removed.candidates
- list of available drawablestargetDensities
- set of e.g. "mdpi"
, "ldpi"
etc.canDownscale
- if no exact match is available, retain the highest qualitypublic static java.util.function.Predicate<Path> createDensityFilter(ProjectFilesystem filesystem, Set<ResourceFilters.Density> targetDensities)
Predicate
that fails for any non-drawable
resource of a different density. Special consideration exists for the default density (ResourceFilters.Density.NO_QUALIFIER
when the target does not exists.