aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-03-02 09:54:55 -0800
committerTor Norbye <tnorbye@google.com>2012-03-02 09:54:55 -0800
commita57daea04a9a9fdc5168979b97b8cbaa4a1e6ca6 (patch)
tree50333e201c3356d76f6e59a292a8340f029e7be2 /eclipse/plugins
parent540b8a8fac9d9f07c0439a08d3f9f8f0486fd71f (diff)
downloadsdk-a57daea04a9a9fdc5168979b97b8cbaa4a1e6ca6.zip
sdk-a57daea04a9a9fdc5168979b97b8cbaa4a1e6ca6.tar.gz
sdk-a57daea04a9a9fdc5168979b97b8cbaa4a1e6ca6.tar.bz2
Handle attributes in the res-auto namespace in the layout editor
Change-Id: I324d7ef6afdb016b457f020e254a75e0a6d71fb8
Diffstat (limited to 'eclipse/plugins')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java11
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) &&