use of org.robolectric.res.ResName in project robolectric by robolectric.
the class AttributeSetBuilderImpl method parse.
private TypedValue parse(Integer attrId, ResName attrResName, String value, String packageName) {
AttributeResource attribute = new AttributeResource(attrResName, value, packageName);
TypedValue outValue = new TypedValue();
if (attribute.isResourceReference()) {
ResName resourceReference = attribute.getResourceReference();
int id = resourceResolver.getIdentifier(resourceReference.name, resourceReference.type, resourceReference.packageName);
if (id == 0) {
throw new IllegalArgumentException("couldn't resolve " + attribute);
}
outValue.type = Res_value.TYPE_REFERENCE;
outValue.data = id;
outValue.resourceId = id;
outValue.string = "@" + id;
} else {
resourceResolver.parseValue(attrId, attrResName, attribute, outValue);
}
return outValue;
}
Aggregations