use of org.robolectric.res.android.ResourceTypes.ResXMLTree_attribute in project robolectric by robolectric.
the class ResXMLParser method getAttributeValue.
public int getAttributeValue(int idx, Ref<Res_value> outValue) {
if (mEventCode == START_TAG) {
ResXMLTree_attrExt tag = new ResXMLTree_attrExt(mTree.mBuffer.buf, mCurExt);
if (idx < dtohs(tag.attributeCount)) {
// final ResXMLTree_attribute attr = (ResXMLTree_attribute)
// (((final int8_t*)tag)
// + dtohs(tag.attributeStart())
// + (dtohs(tag.attributeSize())*idx));
ResXMLTree_attribute attr = tag.attributeAt(idx);
outValue.set(attr.typedValue);
if (mTree.mDynamicRefTable != null && mTree.mDynamicRefTable.lookupResourceValue(outValue) != NO_ERROR) {
return BAD_TYPE;
}
return ResourceTypes.Res_value.SIZEOF;
}
}
return BAD_TYPE;
}
use of org.robolectric.res.android.ResourceTypes.ResXMLTree_attribute in project robolectric by robolectric.
the class ResXMLParser method getAttributeData.
public int getAttributeData(int idx) {
if (mEventCode == START_TAG) {
ResXMLTree_attrExt tag = new ResXMLTree_attrExt(mTree.mBuffer.buf, mCurExt);
if (idx < dtohs(tag.attributeCount)) {
// final ResXMLTree_attribute attr = (ResXMLTree_attribute)
// (((final int8_t*)tag)
// + dtohs(tag.attributeStart)
// + (dtohs(tag.attributeSize)*idx));
ResXMLTree_attribute attr = tag.attributeAt(idx);
if (attr.typedValue.dataType != DataType.DYNAMIC_REFERENCE.code() || mTree.mDynamicRefTable == null) {
return dtohl(attr.typedValue.data);
}
final Ref<Integer> data = new Ref<>(dtohl(attr.typedValue.data));
if (mTree.mDynamicRefTable.lookupResourceId(data) == NO_ERROR) {
return data.get();
}
}
}
return 0;
}
use of org.robolectric.res.android.ResourceTypes.ResXMLTree_attribute in project robolectric by robolectric.
the class ResXMLParser method getAttributeDataType.
public int getAttributeDataType(int idx) {
if (mEventCode == START_TAG) {
final ResXMLTree_attrExt tag = new ResXMLTree_attrExt(mTree.mBuffer.buf, mCurExt);
if (idx < dtohs(tag.attributeCount)) {
// final ResXMLTree_attribute attr = (ResXMLTree_attribute)
// (((final int8_t*)tag)
// + dtohs(tag.attributeStart())
// + (dtohs(tag.attributeSize())*idx));
ResXMLTree_attribute attr = tag.attributeAt(idx);
int type = attr.typedValue.dataType;
if (type != DataType.DYNAMIC_REFERENCE.code()) {
return type;
}
// to regular references at this level, so lie to the caller.
return DataType.REFERENCE.code();
}
}
return DataType.NULL.code();
}
Aggregations