aboutsummaryrefslogtreecommitdiffstats
path: root/ide_common
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2012-05-16 11:35:07 -0700
committerXavier Ducrohet <xav@android.com>2012-05-16 11:35:07 -0700
commitb9f706c82683c9e82197577b7ade91984cc6539a (patch)
treeaa7d8edc80e5be627c0354f7aa8d01a993cc8880 /ide_common
parent7911fa1ef67338907a2fb22d4fdb4203930a4549 (diff)
downloadsdk-b9f706c82683c9e82197577b7ade91984cc6539a.zip
sdk-b9f706c82683c9e82197577b7ade91984cc6539a.tar.gz
sdk-b9f706c82683c9e82197577b7ade91984cc6539a.tar.bz2
Improve search of items into style for legacy layoutlibs.
Legacy versions uses the old API that doesn't specify the namespace of the attribute being queried. The implementation used the namespace of the style as the namespace of the attribute but this make little sense. At better implementation searches in the project's namespace and, if the attribute is not found, then searches in the framework namespace. Change-Id: Ief43ecd45f108162de2b1512027d4eedf2c132db
Diffstat (limited to 'ide_common')
-rw-r--r--ide_common/src/com/android/ide/common/resources/ResourceResolver.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/ide_common/src/com/android/ide/common/resources/ResourceResolver.java b/ide_common/src/com/android/ide/common/resources/ResourceResolver.java
index 43416e7..772d75e 100644
--- a/ide_common/src/com/android/ide/common/resources/ResourceResolver.java
+++ b/ide_common/src/com/android/ide/common/resources/ResourceResolver.java
@@ -167,15 +167,13 @@ public class ResourceResolver extends RenderResources {
@Override
@Deprecated
- public ResourceValue findItemInStyle(StyleResourceValue style, String itemName) {
- ResourceValue item = style.findValue(itemName, style.isFramework());
-
- // if we didn't find it, we look in the parent style (if applicable)
- if (item == null && mStyleInheritanceMap != null) {
- StyleResourceValue parentStyle = mStyleInheritanceMap.get(style);
- if (parentStyle != null) {
- return findItemInStyle(parentStyle, itemName);
- }
+ public ResourceValue findItemInStyle(StyleResourceValue style, String attrName) {
+ // this method is deprecated because it doesn't know about the namespace of the
+ // attribute so we search for the project namespace first and then in the
+ // android namespace if needed.
+ ResourceValue item = findItemInStyle(style, attrName, false /*isFrameworkAttr*/);
+ if (item == null) {
+ item = findItemInStyle(style, attrName, true /*isFrameworkAttr*/);
}
return item;