|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.android.ide.common.rendering.api.RenderResources
public class RenderResources
A class containing all the resources needed to do a rendering.
This contains both the project specific resources and the framework resources, and provide convenience methods to resolve resource and theme references.
Nested Class Summary | |
---|---|
static class |
RenderResources.FrameworkResourceIdProvider
|
Field Summary | |
---|---|
static java.lang.String |
REFERENCE_NULL
|
Constructor Summary | |
---|---|
RenderResources()
|
Method Summary | |
---|---|
ResourceValue |
findItemInStyle(StyleResourceValue style,
java.lang.String attrName)
Deprecated. Use findItemInStyle(StyleResourceValue, String, boolean) since this
method doesn't know the item namespace. |
ResourceValue |
findItemInStyle(StyleResourceValue style,
java.lang.String attrName,
boolean isFrameworkAttr)
Returns the ResourceValue matching a given attribute in a given style. |
ResourceValue |
findItemInTheme(java.lang.String itemName)
Deprecated. Use findItemInTheme(String, boolean) |
ResourceValue |
findItemInTheme(java.lang.String attrName,
boolean isFrameworkAttr)
Returns the ResourceValue matching a given attribute in the current theme. |
ResourceValue |
findResValue(java.lang.String reference,
boolean forceFrameworkOnly)
Searches for, and returns a ResourceValue by its reference. |
StyleResourceValue |
getCurrentTheme()
Returns the StyleResourceValue representing the current theme. |
ResourceValue |
getFrameworkResource(ResourceType resourceType,
java.lang.String resourceName)
Returns a framework resource by type and name. |
ResourceValue |
getProjectResource(ResourceType resourceType,
java.lang.String resourceName)
Returns a project resource by type and name. |
StyleResourceValue |
getTheme(java.lang.String name,
boolean frameworkTheme)
Returns a theme by its name. |
ResourceValue |
resolveResValue(ResourceValue value)
Returns the ResourceValue referenced by the value of value. |
ResourceValue |
resolveValue(ResourceType type,
java.lang.String name,
java.lang.String value,
boolean isFrameworkValue)
Resolves the value of a resource, if the value references a theme or resource value. |
void |
setFrameworkResourceIdProvider(RenderResources.FrameworkResourceIdProvider provider)
|
void |
setLogger(LayoutLog logger)
|
boolean |
themeIsParentOf(StyleResourceValue parentTheme,
StyleResourceValue childTheme)
Returns whether a theme is a parent of a given theme. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String REFERENCE_NULL
Constructor Detail |
---|
public RenderResources()
Method Detail |
---|
public void setFrameworkResourceIdProvider(RenderResources.FrameworkResourceIdProvider provider)
public void setLogger(LayoutLog logger)
public StyleResourceValue getCurrentTheme()
StyleResourceValue
representing the current theme.
public StyleResourceValue getTheme(java.lang.String name, boolean frameworkTheme)
name
- the name of the themeframeworkTheme
- whether the theme is a framework theme.
public boolean themeIsParentOf(StyleResourceValue parentTheme, StyleResourceValue childTheme)
parentTheme
- the parent themechildTheme
- the child theme.
public ResourceValue getFrameworkResource(ResourceType resourceType, java.lang.String resourceName)
resourceType
- the type of the resourceresourceName
- the name of the resourcepublic ResourceValue getProjectResource(ResourceType resourceType, java.lang.String resourceName)
resourceType
- the type of the resourceresourceName
- the name of the resource@Deprecated public ResourceValue findItemInTheme(java.lang.String itemName)
findItemInTheme(String, boolean)
ResourceValue
matching a given name in the current theme. If the
item is not directly available in the theme, the method looks in its parent theme.
itemName
- the name of the item to search for.
ResourceValue
object or null
public ResourceValue findItemInTheme(java.lang.String attrName, boolean isFrameworkAttr)
ResourceValue
matching a given attribute in the current theme. If the
item is not directly available in the theme, the method looks in its parent theme.
attrName
- the name of the attribute to search for.isFrameworkAttr
- whether the attribute is a framework attribute
ResourceValue
object or null
@Deprecated public ResourceValue findItemInStyle(StyleResourceValue style, java.lang.String attrName)
findItemInStyle(StyleResourceValue, String, boolean)
since this
method doesn't know the item namespace.
ResourceValue
matching a given name in a given style. If the
item is not directly available in the style, the method looks in its parent style.
This version of doesn't support providing the namespace of the attribute so it'll search
in both the project's namespace and then in the android namespace.
style
- the style to search inattrName
- the name of the attribute to search for.
ResourceValue
object or null
public ResourceValue findItemInStyle(StyleResourceValue style, java.lang.String attrName, boolean isFrameworkAttr)
ResourceValue
matching a given attribute in a given style. If the
item is not directly available in the style, the method looks in its parent style.
style
- the style to search inattrName
- the name of the attribute to search for.isFrameworkAttr
- whether the attribute is a framework attribute
ResourceValue
object or null
public ResourceValue findResValue(java.lang.String reference, boolean forceFrameworkOnly)
ResourceValue
by its reference.
The reference format can be:
@resType/resName
@android:resType/resName
@resType/android:resName
?resType/resName
?android:resType/resName
?resType/android:resNameAny other string format will return
null
.
The actual format of a reference is @[namespace:]resType/resNamebut this method only support the android namespace.
reference
- the resource reference to search for.forceFrameworkOnly
- if true all references are considered to be toward framework
resource even if the reference does not include the android: prefix.
ResourceValue
or null
.public ResourceValue resolveValue(ResourceType type, java.lang.String name, java.lang.String value, boolean isFrameworkValue)
ResourceValue
object that does not
reference another resource.
If the resource cannot be resolved, it returns null
.
If a value that does not need to be resolved is given, the method will return a new
instance of ResourceValue
that contains the input value.
type
- the type of the resourcename
- the name of the attribute containing this value.value
- the resource value, or reference to resolveisFrameworkValue
- whether the value is a framework value.
null
if it failed to resolve it.public ResourceValue resolveResValue(ResourceValue value)
ResourceValue
referenced by the value of value.
This method ensures that it returns a ResourceValue
object that does not
reference another resource.
If the resource cannot be resolved, it returns null
.
If a value that does not need to be resolved is given, the method will return the input
value.
value
- the value containing the reference to resolve.
ResourceValue
object or null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |