diff options
-rw-r--r-- | ide_common/src/com/android/ide/common/resources/ResourceResolver.java | 16 | ||||
-rw-r--r-- | layoutlib_api/src/com/android/ide/common/rendering/api/RenderResources.java | 10 |
2 files changed, 14 insertions, 12 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; diff --git a/layoutlib_api/src/com/android/ide/common/rendering/api/RenderResources.java b/layoutlib_api/src/com/android/ide/common/rendering/api/RenderResources.java index 8ccbd69..f9e02d6 100644 --- a/layoutlib_api/src/com/android/ide/common/rendering/api/RenderResources.java +++ b/layoutlib_api/src/com/android/ide/common/rendering/api/RenderResources.java @@ -127,14 +127,18 @@ public class RenderResources { * Returns the {@link ResourceValue} matching a given name in a given style. If the * item is not directly available in the style, the method looks in its parent style. * + * This version of doesn't support providing the namespace of the attribute so it'll search + * in both the project's namespace and then in the android namespace. + * * @param style the style to search in - * @param itemName the name of the item to search for. + * @param attrName the name of the attribute to search for. * @return the {@link ResourceValue} object or <code>null</code> * - * @Deprecated Use {@link #findItemInStyle(StyleResourceValue, String, boolean)} + * @Deprecated Use {@link #findItemInStyle(StyleResourceValue, String, boolean)} since this + * method doesn't know the item namespace. */ @Deprecated - public ResourceValue findItemInStyle(StyleResourceValue style, String itemName) { + public ResourceValue findItemInStyle(StyleResourceValue style, String attrName) { return null; } |