summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/util/AttributeSet.java70
1 files changed, 56 insertions, 14 deletions
diff --git a/core/java/android/util/AttributeSet.java b/core/java/android/util/AttributeSet.java
index 82592b9f7e06..470526cf1bdd 100644
--- a/core/java/android/util/AttributeSet.java
+++ b/core/java/android/util/AttributeSet.java
@@ -56,10 +56,53 @@ package android.util;
* identifier associated with a particular XML attribute name.
*/
public interface AttributeSet {
+ /**
+ * Returns the number of attributes available in the set.
+ *
+ * @return A positive integer, or 0 if the set is empty.
+ */
public int getAttributeCount();
+
+ /**
+ * Returns the name of the specified attribute.
+ *
+ * @param index Index of the desired attribute, 0...count-1.
+ *
+ * @return A String containing the name of the attribute, or null if the
+ * attribute cannot be found.
+ */
public String getAttributeName(int index);
+
+ /**
+ * Returns the value of the specified attribute as a string representation.
+ *
+ * @param index Index of the desired attribute, 0...count-1.
+ *
+ * @return A String containing the value of the attribute, or null if the
+ * attribute cannot be found.
+ */
public String getAttributeValue(int index);
+
+ /**
+ * Returns the value of the specified attribute as a string representation.
+ * The lookup is performed using the attribute name.
+ *
+ * @param namespace The namespace of the attribute to get the value from.
+ * @param name The name of the attribute to get the value from.
+ *
+ * @return A String containing the value of the attribute, or null if the
+ * attribute cannot be found.
+ */
public String getAttributeValue(String namespace, String name);
+
+ /**
+ * Returns a description of the current position of the attribute set.
+ * For instance, if the attribute set is loaded from an XML document,
+ * the position description could indicate the current line number.
+ *
+ * @return A string representation of the current position in the set,
+ * may be null.
+ */
public String getPositionDescription();
/**
@@ -80,7 +123,8 @@ public interface AttributeSet {
/**
* Return the index of the value of 'attribute' in the list 'options'.
- *
+ *
+ * @param namespace Namespace of attribute to retrieve.
* @param attribute Name of attribute to retrieve.
* @param options List of strings whose values we are checking against.
* @param defaultValue Value returned if attribute doesn't exist or no
@@ -94,6 +138,7 @@ public interface AttributeSet {
/**
* Return the boolean value of 'attribute'.
*
+ * @param namespace Namespace of attribute to retrieve.
* @param attribute The attribute to retrieve.
* @param defaultValue What to return if the attribute isn't found.
*
@@ -111,6 +156,7 @@ public interface AttributeSet {
* "@package:type/resource"); the other method returns a resource
* identifier that identifies the name of the attribute.
*
+ * @param namespace Namespace of attribute to retrieve.
* @param attribute The attribute to retrieve.
* @param defaultValue What to return if the attribute isn't found.
*
@@ -122,6 +168,7 @@ public interface AttributeSet {
/**
* Return the integer value of 'attribute'.
*
+ * @param namespace Namespace of attribute to retrieve.
* @param attribute The attribute to retrieve.
* @param defaultValue What to return if the attribute isn't found.
*
@@ -135,6 +182,7 @@ public interface AttributeSet {
* unsigned value. In particular, the formats 0xn...n and #n...n are
* handled.
*
+ * @param namespace Namespace of attribute to retrieve.
* @param attribute The attribute to retrieve.
* @param defaultValue What to return if the attribute isn't found.
*
@@ -146,6 +194,7 @@ public interface AttributeSet {
/**
* Return the float value of 'attribute'.
*
+ * @param namespace Namespace of attribute to retrieve.
* @param attribute The attribute to retrieve.
* @param defaultValue What to return if the attribute isn't found.
*
@@ -165,8 +214,7 @@ public interface AttributeSet {
*
* @return Index in to 'options' or defaultValue.
*/
- public int getAttributeListValue(int index,
- String[] options, int defaultValue);
+ public int getAttributeListValue(int index, String[] options, int defaultValue);
/**
* Return the boolean value of attribute at 'index'.
@@ -176,8 +224,7 @@ public interface AttributeSet {
*
* @return Resulting value.
*/
- public boolean getAttributeBooleanValue(int index,
- boolean defaultValue);
+ public boolean getAttributeBooleanValue(int index, boolean defaultValue);
/**
* Return the value of attribute at 'index' as a resource identifier.
@@ -193,8 +240,7 @@ public interface AttributeSet {
*
* @return Resulting value.
*/
- public int getAttributeResourceValue(int index,
- int defaultValue);
+ public int getAttributeResourceValue(int index, int defaultValue);
/**
* Return the integer value of attribute at 'index'.
@@ -204,8 +250,7 @@ public interface AttributeSet {
*
* @return Resulting value.
*/
- public int getAttributeIntValue(int index,
- int defaultValue);
+ public int getAttributeIntValue(int index, int defaultValue);
/**
* Return the integer value of attribute at 'index' that is formatted as an
@@ -217,8 +262,7 @@ public interface AttributeSet {
*
* @return Resulting value.
*/
- public int getAttributeUnsignedIntValue(int index,
- int defaultValue);
+ public int getAttributeUnsignedIntValue(int index, int defaultValue);
/**
* Return the float value of attribute at 'index'.
@@ -228,8 +272,7 @@ public interface AttributeSet {
*
* @return Resulting value.
*/
- public float getAttributeFloatValue(int index,
- float defaultValue);
+ public float getAttributeFloatValue(int index, float defaultValue);
/**
* Return the value of the "id" attribute or null if there is not one.
@@ -266,4 +309,3 @@ public interface AttributeSet {
*/
public int getStyleAttribute();
}
-