You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
AssetManager: special handling for style and array types
These are complex and can't be loaded into a TypedArray
This commit is contained in:
@@ -804,7 +804,7 @@ public final class AssetManager {
|
||||
ValueItem valueItem = parser.getResXmlAttributeAt(xmlCache.get(resId));
|
||||
value.type = valueItem.getType();
|
||||
value.data = valueItem.getData();
|
||||
value.resourceId = resId;
|
||||
value.resourceId = 0;
|
||||
value.assetCookie = -1;
|
||||
if (value.type != TypedValue.TYPE_ATTRIBUTE)
|
||||
found = true;
|
||||
@@ -820,6 +820,14 @@ public final class AssetManager {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (value.type == TypedValue.TYPE_REFERENCE && value.data != 0) {
|
||||
String typeName = getResourceTypeName(value.data);
|
||||
if ("style".equals(typeName) || "array".equals(typeName)) {
|
||||
// style and array are complex types, which can't be stored in a TypedArray
|
||||
value.resourceId = value.data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((value.type == TypedValue.TYPE_REFERENCE || value.type == TypedValue.TYPE_ATTRIBUTE) && value.data != resId) {
|
||||
resId = value.data;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user