List<String> list = new ArrayList<String>(inBoth);
Collections.sort(list);
// Chain locations together
Collections.sort(files);
Location location = null;
for (File file : files) {
Location linkedLocation = location;
location = new Location(file, null, null);
location.setSecondary(linkedLocation);
}
context.client.report(context,
ICON_DENSITIES,
location,
String.format(
"The following images appear in both -nodpi and in a density folder: %1$s",
LintUtils.formatList(list, 10)),
null);
}
}
}
if (context.configuration.isEnabled(ICON_DENSITIES)) {
// Look for folders missing some of the specific assets
Set<String> allNames = new HashSet<String>();
for (Entry<File,Set<String>> entry : folderToNames.entrySet()) {
if (!isNoDpiFolder(entry.getKey())) {
Set<String> names = entry.getValue();
allNames.addAll(names);
}
}
for (Map.Entry<File, Set<String>> entry : folderToNames.entrySet()) {
File file = entry.getKey();
if (isNoDpiFolder(file)) {
continue;
}
Set<String> names = entry.getValue();
if (names.size() != allNames.size()) {
List<String> delta =
new ArrayList<String>(difference(allNames, names));
Collections.sort(delta);
String foundIn = "";
if (delta.size() == 1) {
// Produce list of where the icon is actually defined
List<String> defined = new ArrayList<String>();
String name = delta.get(0);
for (Map.Entry<File, Set<String>> e : folderToNames.entrySet()) {
if (e.getValue().contains(name)) {
defined.add(e.getKey().getName());
}
}
if (defined.size() > 0) {
foundIn = String.format(" (found in %1$s)",
LintUtils.formatList(defined, 5));
}
}
context.client.report(context,
ICON_DENSITIES,
new Location(file, null, null),
String.format(
"Missing the following drawables in %1$s: %2$s%3$s",
file.getName(),
LintUtils.formatList(delta, 5),
foundIn),