in resources/src/main/java/org/robolectric/res/android/ConfigDescription.java [693:771]
private static boolean parseDensity(String name, ResTable_config out) {
if (Objects.equals(name, kWildcardName)) {
if (out != null) {
out.density = ResTable_config.DENSITY_DEFAULT;
}
return true;
}
if (Objects.equals(name, "anydpi")) {
if (out != null) {
out.density = ResTable_config.DENSITY_ANY;
}
return true;
}
if (Objects.equals(name, "nodpi")) {
if (out != null) {
out.density = ResTable_config.DENSITY_NONE;
}
return true;
}
if (Objects.equals(name, "ldpi")) {
if (out != null) {
out.density = ResTable_config.DENSITY_LOW;
}
return true;
}
if (Objects.equals(name, "mdpi")) {
if (out != null) {
out.density = ResTable_config.DENSITY_MEDIUM;
}
return true;
}
if (Objects.equals(name, "tvdpi")) {
if (out != null) {
out.density = ResTable_config.DENSITY_TV;
}
return true;
}
if (Objects.equals(name, "hdpi")) {
if (out != null) {
out.density = ResTable_config.DENSITY_HIGH;
}
return true;
}
if (Objects.equals(name, "xhdpi")) {
if (out != null) {
out.density = ResTable_config.DENSITY_XHIGH;
}
return true;
}
if (Objects.equals(name, "xxhdpi")) {
if (out != null) {
out.density = ResTable_config.DENSITY_XXHIGH;
}
return true;
}
if (Objects.equals(name, "xxxhdpi")) {
if (out != null) {
out.density = ResTable_config.DENSITY_XXXHIGH;
}
return true;
}
// check that we have 'dpi' after the last digit.
Matcher matcher = DENSITY_PATTERN.matcher(name);
if (matcher.matches()) {
out.density = Integer.parseInt(matcher.group(1));
return true;
}
return false;
}