aboutsummaryrefslogtreecommitdiffstats
path: root/rule_api
diff options
context:
space:
mode:
Diffstat (limited to 'rule_api')
-rwxr-xr-xrule_api/src/com/android/ide/common/api/IAttributeInfo.java2
-rwxr-xr-xrule_api/src/com/android/ide/common/api/INode.java20
-rw-r--r--rule_api/src/com/android/ide/common/api/IViewMetadata.java10
3 files changed, 30 insertions, 2 deletions
diff --git a/rule_api/src/com/android/ide/common/api/IAttributeInfo.java b/rule_api/src/com/android/ide/common/api/IAttributeInfo.java
index 2a6ecd8..da1bc9e 100755
--- a/rule_api/src/com/android/ide/common/api/IAttributeInfo.java
+++ b/rule_api/src/com/android/ide/common/api/IAttributeInfo.java
@@ -81,4 +81,6 @@ public interface IAttributeInfo {
/** Returns the documentation for deprecated attributes. Null if not deprecated. */
public String getDeprecatedDoc();
+ /** Returns the fully qualified class name of the view defining this attribute */
+ public String getDefinedBy();
}
diff --git a/rule_api/src/com/android/ide/common/api/INode.java b/rule_api/src/com/android/ide/common/api/INode.java
index e3f34a9..b4cb638 100755
--- a/rule_api/src/com/android/ide/common/api/INode.java
+++ b/rule_api/src/com/android/ide/common/api/INode.java
@@ -19,6 +19,8 @@ package com.android.ide.common.api;
import com.android.ide.common.api.IDragElement.IDragAttribute;
+import java.util.List;
+
/**
* Represents a view in the XML layout being edited.
@@ -217,11 +219,25 @@ public interface INode {
* If you want attributes actually written in the XML and their values, please use
* {@link #getStringAttr(String, String)} or {@link #getLiveAttributes()} instead.
*
- * @return A non-null possible-empty list of {@link IAttributeInfo}.
+ * @return A non-null possibly-empty list of {@link IAttributeInfo}.
*/
public IAttributeInfo[] getDeclaredAttributes();
/**
+ * Returns the list of classes (fully qualified class names) that are
+ * contributing properties to the {@link #getDeclaredAttributes()} attribute
+ * list, in order from most specific to least specific (in other words,
+ * android.view.View will be last in the list.) This is usually the same as
+ * the super class chain of a view, but it skips any views that do not
+ * contribute attributes.
+ *
+ * @return a list of views classes that contribute attributes to this node,
+ * which is never null because at least android.view.View will
+ * contribute attributes.
+ */
+ public List<String> getAttributeSources();
+
+ /**
* Returns the list of all attributes defined in the XML for this node.
* <p/>
* This looks up an attribute in the <em>current</em> XML source, not the in-memory model.
@@ -232,7 +248,7 @@ public interface INode {
* If you want a list of all possible attributes, whether used in the XML or not by
* this node, please see {@link #getDeclaredAttributes()} instead.
*
- * @return A non-null possible-empty list of {@link IAttribute}.
+ * @return A non-null possibly-empty list of {@link IAttribute}.
*/
public IAttribute[] getLiveAttributes();
diff --git a/rule_api/src/com/android/ide/common/api/IViewMetadata.java b/rule_api/src/com/android/ide/common/api/IViewMetadata.java
index 0687f30..8646764 100644
--- a/rule_api/src/com/android/ide/common/api/IViewMetadata.java
+++ b/rule_api/src/com/android/ide/common/api/IViewMetadata.java
@@ -16,6 +16,8 @@
package com.android.ide.common.api;
+import java.util.List;
+
/**
* Metadata about a particular view. The metadata for a View can be found by asking the
* {@link IClientRulesEngine} for the metadata for a given class via
@@ -49,6 +51,14 @@ public interface IViewMetadata {
public FillPreference getFillPreference();
/**
+ * Returns the most common attributes for this view.
+ *
+ * @return a list of attribute names (not including a namespace prefix) that
+ * are commonly set for this type of view, never null
+ */
+ public List<String> getTopAttributes();
+
+ /**
* Types of fill behavior that views can prefer.
* <p>
* TODO: Consider better names. FillPolicy? Stretchiness?