Try to resolve IDs also as enums

This is intended to cover the edge case in ConstraintLayout (and
possibly in other places) where an attribute is defined as
reference|enum.
If we can not resolve the value as a reference, try to resolve it as an
enum and return the value.

Change-Id: I2817aa5d78500247a2e9aec5411586a1db13791d
(cherry picked from commit b24b563654bf7c007f0912bf32fbab948fcb6daa)
This commit is contained in:
Diego Perez
2016-07-29 10:31:37 +01:00
parent b49c45bb08
commit f627cbb15b

View File

@@ -638,7 +638,15 @@ public final class BridgeTypedArray extends TypedArray {
}
}
// not a direct id valid reference? resolve it
// not a direct id valid reference. First check if it's an enum (this is a corner case
// for attributes that have a reference|enum type), then fallback to resolve
// as an ID without prefix.
Integer enumValue = resolveEnumAttribute(index);
if (enumValue != null) {
return enumValue;
}
// Ok, not an enum, resolve as an ID
Integer idValue;
if (resValue.isFramework()) {