AXmlResourceParser::getAttributeValue(): do not use raw value for references and styles.

This commit is contained in:
Ryszard Wiśniewski 2011-05-03 03:51:51 +02:00
parent 855f664d40
commit 76d8aa0abc

View File

@ -306,15 +306,15 @@ public class AXmlResourceParser implements XmlResourceParser {
public String getAttributeValue(int index) {
int offset = getAttributeOffset(index);
int valueString = m_attributes[offset + ATTRIBUTE_IX_VALUE_STRING];
if (valueString != -1) {
return AndrolibResources.escapeTextForResXml(
m_strings.getString(valueString));
}
int valueType = m_attributes[offset + ATTRIBUTE_IX_VALUE_TYPE];
int valueData = m_attributes[offset + ATTRIBUTE_IX_VALUE_DATA];
int valueString = m_attributes[offset + ATTRIBUTE_IX_VALUE_STRING];
if (mAttrDecoder != null) {
if (mAttrDecoder != null && (
valueString == -1
|| valueType == TypedValue.TYPE_REFERENCE
|| valueType == TypedValue.TYPE_ATTRIBUTE
)) {
try {
return mAttrDecoder.decode(valueType, valueData,
getAttributeNameResource(index));
@ -329,6 +329,11 @@ public class AXmlResourceParser implements XmlResourceParser {
}
}
if (valueString != -1) {
return AndrolibResources.escapeTextForResXml(
m_strings.getString(valueString));
}
return TypedValue.coerceToString(valueType, valueData);
}