|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.android.ide.common.resources.ResourceItem
public class ResourceItem
An android resource. This is a representation of the resource, not of its value(s). It gives access to all the source files that generate this particular resource which then can be used to access the actual value(s).
Constructor Summary | |
---|---|
ResourceItem(java.lang.String name)
Constructs a new ResourceItem. |
Method Summary | |
---|---|
protected void |
add(ResourceFile file)
Adds a new source file. |
int |
compareTo(ResourceItem other)
Compares the ResourceItem to another. |
int |
getAlternateCount()
Returns the number of alternate versions for this resource. |
java.lang.String |
getName()
Returns the name of the resource. |
com.android.ide.common.rendering.api.ResourceValue |
getResourceValue(com.android.resources.ResourceType type,
FolderConfiguration referenceConfig,
boolean isFramework)
Returns a ResourceValue for this item based on the given configuration. |
ResourceFile[] |
getSourceFileArray()
Returns the sorted list of ResourceItem objects for this resource item. |
java.util.List<ResourceFile> |
getSourceFileList()
Returns the list of source file for this resource. |
java.lang.String |
getXmlString(com.android.resources.ResourceType type,
boolean system)
Returns a formatted string usable in an XML to use for the ResourceItem . |
boolean |
hasAlternates()
Returns if the resource has at least one non-default version. |
boolean |
hasDefault()
Returns whether the resource has a default version, with no qualifier. |
protected boolean |
hasNoSourceFile()
Returns true if the item has no source file. |
boolean |
isDeclaredInline()
Returns whether the ID resource has been declared inline inside another resource XML file. |
boolean |
isEditableDirectly()
Returns whether the resource is editable directly. |
protected void |
removeFile(ResourceFile file)
Removes a file from the list of source files. |
protected void |
reset()
Reset the item by emptying its source file list. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ResourceItem(java.lang.String name)
name
- the name of the resource as it appears in the XML and R.java files.Method Detail |
---|
public final java.lang.String getName()
public int compareTo(ResourceItem other)
ResourceItem
to another.
compareTo
in interface java.lang.Comparable<ResourceItem>
other
- the ResourceItem to be compared to.public boolean isEditableDirectly()
ResourceType.ID
that aren't declared inline.
public boolean isDeclaredInline()
ResourceType.ID
, this will always return false
.
public com.android.ide.common.rendering.api.ResourceValue getResourceValue(com.android.resources.ResourceType type, FolderConfiguration referenceConfig, boolean isFramework)
ResourceValue
for this item based on the given configuration.
If the ResourceItem has several source files, one will be selected based on the config.
type
- the type of the resource. This is necessary because ResourceItem doesn't embed
its type, but ResourceValue does.referenceConfig
- the config of the resource item.isFramework
- whether the resource is a framework value. Same as the type.
protected void add(ResourceFile file)
file
- the source file.protected void removeFile(ResourceFile file)
file
- the file to removeprotected boolean hasNoSourceFile()
true
if the item has no source file.
protected void reset()
public ResourceFile[] getSourceFileArray()
ResourceItem
objects for this resource item.
public java.util.List<ResourceFile> getSourceFileList()
public boolean hasAlternates()
ResourceFile.getConfiguration()
,
FolderConfiguration.isDefault()
public boolean hasDefault()
ResourceFile.getConfiguration()
,
FolderConfiguration.isDefault()
public int getAlternateCount()
ResourceFile.getConfiguration()
,
FolderConfiguration.isDefault()
public java.lang.String getXmlString(com.android.resources.ResourceType type, boolean system)
ResourceItem
.
system
- Whether this is a system resource or a project resource.
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |