Methods Summary |
---|
public boolean | getAttributeBooleanValue(int index, boolean defaultValue)
String value = getAttributeValue(index);
if (value != null) {
ResourceValue r = getResourceValue(value);
if (r != null) {
value = r.getValue();
}
return XmlUtils.convertValueToBoolean(value, defaultValue);
}
return defaultValue;
|
public boolean | getAttributeBooleanValue(java.lang.String namespace, java.lang.String attribute, boolean defaultValue)
String value = getAttributeValue(namespace, attribute);
if (value != null) {
ResourceValue r = getResourceValue(value);
if (r != null) {
value = r.getValue();
}
return XmlUtils.convertValueToBoolean(value, defaultValue);
}
return defaultValue;
|
public float | getAttributeFloatValue(int index, float defaultValue)
String s = getAttributeValue(index);
if (s != null) {
ResourceValue r = getResourceValue(s);
if (r != null) {
s = r.getValue();
}
return Float.parseFloat(s);
}
return defaultValue;
|
public float | getAttributeFloatValue(java.lang.String namespace, java.lang.String attribute, float defaultValue)
String s = getAttributeValue(namespace, attribute);
if (s != null) {
ResourceValue r = getResourceValue(s);
if (r != null) {
s = r.getValue();
}
return Float.parseFloat(s);
}
return defaultValue;
|
public int | getAttributeIntValue(int index, int defaultValue)
String value = getAttributeValue(index);
if (value != null) {
ResourceValue r = getResourceValue(value);
if (r != null) {
value = r.getValue();
}
if (value.charAt(0) == '#") {
return ResourceHelper.getColor(value);
}
return XmlUtils.convertValueToInt(value, defaultValue);
}
return defaultValue;
|
public int | getAttributeIntValue(java.lang.String namespace, java.lang.String attribute, int defaultValue)
String value = getAttributeValue(namespace, attribute);
if (value != null) {
ResourceValue r = getResourceValue(value);
if (r != null) {
value = r.getValue();
}
return XmlUtils.convertValueToInt(value, defaultValue);
}
return defaultValue;
|
public int | getAttributeListValue(java.lang.String namespace, java.lang.String attribute, java.lang.String[] options, int defaultValue)
String value = getAttributeValue(namespace, attribute);
if (value != null) {
ResourceValue r = getResourceValue(value);
if (r != null) {
value = r.getValue();
}
return XmlUtils.convertValueToList(value, options, defaultValue);
}
return defaultValue;
|
public int | getAttributeListValue(int index, java.lang.String[] options, int defaultValue)
return XmlUtils.convertValueToList(
getAttributeValue(index), options, defaultValue);
|
public int | getAttributeNameResource(int index)
// get the attribute name.
String name = getAttributeName(index);
// get the attribute namespace
String ns = mParser.getAttributeNamespace(index);
if (BridgeConstants.NS_RESOURCES.equals(ns)) {
Integer v = Bridge.getResourceId(ResourceType.ATTR, name);
if (v != null) {
return v.intValue();
}
return 0;
}
// this is not an attribute in the android namespace, we query the customviewloader, if
// the namespaces match.
if (mContext.getProjectCallback().getNamespace().equals(ns)) {
Integer v = mContext.getProjectCallback().getResourceId(ResourceType.ATTR, name);
if (v != null) {
return v.intValue();
}
}
return 0;
|
public int | getAttributeResourceValue(int index, int defaultValue)
String value = getAttributeValue(index);
return resolveResourceValue(value, defaultValue);
|
public int | getAttributeResourceValue(java.lang.String namespace, java.lang.String attribute, int defaultValue)
String value = getAttributeValue(namespace, attribute);
return resolveResourceValue(value, defaultValue);
|
public int | getAttributeUnsignedIntValue(int index, int defaultValue)
String value = getAttributeValue(index);
if (value != null) {
ResourceValue r = getResourceValue(value);
if (r != null) {
value = r.getValue();
}
return XmlUtils.convertValueToUnsignedInt(value, defaultValue);
}
return defaultValue;
|
public int | getAttributeUnsignedIntValue(java.lang.String namespace, java.lang.String attribute, int defaultValue)
String value = getAttributeValue(namespace, attribute);
if (value != null) {
ResourceValue r = getResourceValue(value);
if (r != null) {
value = r.getValue();
}
return XmlUtils.convertValueToUnsignedInt(value, defaultValue);
}
return defaultValue;
|
private com.android.ide.common.rendering.api.ResourceValue | getResourceValue(java.lang.String value)Returns a resolved {@link ResourceValue} from a given value.
// now look for this particular value
RenderResources resources = mContext.getRenderResources();
return resources.resolveResValue(resources.findResValue(value, mPlatformFile));
|
private int | resolveResourceValue(java.lang.String value, int defaultValue)Resolves and return a value to its associated integer.
ResourceValue resource = getResourceValue(value);
if (resource != null) {
Integer id = null;
if (mPlatformFile || resource.isFramework()) {
id = Bridge.getResourceId(resource.getResourceType(), resource.getName());
} else {
id = mContext.getProjectCallback().getResourceId(
resource.getResourceType(), resource.getName());
}
if (id != null) {
return id;
}
}
return defaultValue;
|