diff options
author | Xavier Ducrohet <xav@google.com> | 2012-03-02 10:33:59 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-03-02 10:33:59 -0800 |
commit | 46c03c14f4e0b3d636a59fa7ff20e4b413414bde (patch) | |
tree | d78328824d8f6d9a5f374e7275e793075f6503ab | |
parent | c35169fdfabc716a5817563a9644894278dd711f (diff) | |
parent | a57daea04a9a9fdc5168979b97b8cbaa4a1e6ca6 (diff) | |
download | sdk-46c03c14f4e0b3d636a59fa7ff20e4b413414bde.zip sdk-46c03c14f4e0b3d636a59fa7ff20e4b413414bde.tar.gz sdk-46c03c14f4e0b3d636a59fa7ff20e4b413414bde.tar.bz2 |
Merge "Handle attributes in the res-auto namespace in the layout editor"
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java index f57d904..6915052 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java @@ -16,6 +16,7 @@ package com.android.ide.eclipse.adt.internal.editors.layout; +import static com.android.ide.common.layout.LayoutConstants.ANDROID_URI; import static com.android.ide.common.layout.LayoutConstants.ATTR_LAYOUT_HEIGHT; import static com.android.ide.common.layout.LayoutConstants.ATTR_LAYOUT_WIDTH; import static com.android.ide.common.layout.LayoutConstants.ATTR_PADDING; @@ -24,6 +25,7 @@ import static com.android.ide.common.layout.LayoutConstants.VALUE_MATCH_PARENT; import static com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors.ATTR_LAYOUT; import static com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors.VIEW_FRAGMENT; import static com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors.VIEW_INCLUDE; +import static com.android.tools.lint.detector.api.LintConstants.AUTO_URI; import com.android.ide.common.rendering.api.ILayoutPullParser; import com.android.ide.common.rendering.api.ViewInfo; @@ -366,6 +368,15 @@ public class UiElementPullParser extends BasePullParser { } Node attribute = xmlNode.getAttributes().getNamedItemNS(namespace, localName); + + // Auto-convert http://schemas.android.com/apk/res-auto resources. The lookup + // will be for the current application's resource package, e.g. + // http://schemas.android.com/apk/res/foo.bar, but the XML document will + // be using http://schemas.android.com/apk/res-auto in library projects: + if (attribute == null && namespace != null && !namespace.equals(ANDROID_URI)) { + attribute = xmlNode.getAttributes().getNamedItemNS(AUTO_URI, localName); + } + if (attribute != null) { String value = attribute.getNodeValue(); if (mIncreaseExistingPadding && ATTR_PADDING.equals(localName) && |