diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java index ba0b682c85c5..45fadf9069e7 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java @@ -89,10 +89,7 @@ public class PropertyParser { component.setProperties(Collections.emptyList()); } else { - Class componentClass = myClassLoader.loadClass(info.getClassName()); - if (componentClass.getName().equals("com.android.layoutlib.bridge.MockView")) { - componentClass = myClassLoader.loadClass("android.view.View"); - } + Class componentClass = configureClass(myClassLoader.loadClass(info.getClassName())); component.setProperties(loadWidgetProperties(componentClass, model)); } } @@ -113,8 +110,26 @@ public class PropertyParser { } if (layoutParams != null) { - List properties = loadLayoutProperties(layoutParams, 0, parent.getMetaModel()); + MetaModel[] models = new MetaModel[layoutParams.length]; + models[0] = parent.getMetaModel(); + for (int i = 1; i < layoutParams.length; i++) { + if (models[i - 1] == null) { + break; + } + String extendTarget = models[i - 1].getTarget(); + if (extendTarget == null) { + break; + } + + Class superClass = myClassLoader.loadClass(extendTarget).getSuperclass(); + if (superClass != null) { + superClass = configureClass(superClass); + models[i] = myMetaManager.getModelByTarget(superClass.getName()); + } + } + + List properties = loadLayoutProperties(layoutParams, 0, models); if (!properties.isEmpty()) { properties = new ArrayList(properties); properties.addAll(component.getProperties()); @@ -168,16 +183,16 @@ public class PropertyParser { "paddingBottom", "bottom", "paddingStart", "start", "paddingEnd", "end"); - paddingProperty.decorate(model); + if (model != null) { + paddingProperty.decorate(model); + } properties.add(paddingProperty); } } Class superComponentClass = componentClass.getSuperclass(); if (superComponentClass != null) { - if (superComponentClass.getName().equals("com.android.layoutlib.bridge.MockView")) { - superComponentClass = myClassLoader.loadClass("android.view.View"); - } + superComponentClass = configureClass(superComponentClass); List superProperties = loadWidgetProperties(superComponentClass, myMetaManager.getModelByTarget(superComponentClass.getName())); @@ -206,8 +221,16 @@ public class PropertyParser { return properties; } - private List loadLayoutProperties(String[] components, int index, MetaModel model) throws Exception { + private Class configureClass(Class viewClass) throws Exception { + if (viewClass.getName().equals("com.android.layoutlib.bridge.MockView")) { + return myClassLoader.loadClass("android.view.View"); + } + return viewClass; + } + + private List loadLayoutProperties(String[] components, int index, MetaModel[] models) throws Exception { String component = components[index]; + MetaModel model = models[index]; List properties = myCachedProperties.get(component); @@ -272,7 +295,7 @@ public class PropertyParser { } if (++index < components.length) { - for (Property property : loadLayoutProperties(components, index, model)) { + for (Property property : loadLayoutProperties(components, index, models)) { if (PropertyTable.findProperty(properties, property) == -1) { if (model == null) { properties.add(property); diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadViewLayoutWithData.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadViewLayoutWithData.java index ca1af9c2692d..fdd9080751d3 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/RadViewLayoutWithData.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadViewLayoutWithData.java @@ -15,9 +15,12 @@ */ package com.intellij.android.designer.model; +import org.jetbrains.annotations.NotNull; + /** * @author Alexander Lobas */ public abstract class RadViewLayoutWithData extends RadViewLayout { + @NotNull public abstract String[] getLayoutParams(); } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml b/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml index 2fd7fd6d54c7..d36dff31895c 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml +++ b/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml @@ -32,9 +32,9 @@ /> - + @@ -991,7 +991,7 @@ - + -