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)
diff --git a/bridge/src/android/content/res/BridgeTypedArray.java b/bridge/src/android/content/res/BridgeTypedArray.java
index 1d5ac0c..9da65a6 100644
--- a/bridge/src/android/content/res/BridgeTypedArray.java
+++ b/bridge/src/android/content/res/BridgeTypedArray.java
@@ -638,7 +638,15 @@
}
}
- // 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()) {