Class ResourceFilters

  • public class ResourceFilters
    extends Object
    • Field Detail


        public static final<String> SUPPORTED_RESOURCE_DIRECTORIES
        The set of supported directories in resource folders. This is defined in
    • Method Detail

      • createImageDensityFilter

        public 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.
        candidates - list of available drawables
        targetDensities - set of e.g. "mdpi", "ldpi" etc.
        canDownscale - if no exact match is available, retain the highest quality
        a predicate as above
      • createDensityFilter

        public 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. Special consideration exists for the default density (ResourceFilters.Density.NO_QUALIFIER when the target does not exists.