public class GeneratedResourceSet extends ResourceSet
ResourceSet that contains only generated files (e.g. PNGs generated from a vector
drawable XML). It is always a mirror of a normal ResourceSet which delegates to this
set when it encounters a file that needs to be replaced by generated files.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ATTR_GENERATED |
ATTR_AAPT_NAMESPACE, ATTR_FROM_DEPENDENCY, ATTR_GENERATED_SET| Constructor and Description |
|---|
GeneratedResourceSet(ResourceSet originalSet) |
GeneratedResourceSet(java.lang.String name,
com.android.ide.common.rendering.api.ResourceNamespace namespace,
java.lang.String libraryName) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addItem(I item,
java.lang.String key) |
void |
addSource(java.io.File file)
Adds a new source file
|
void |
addSources(java.util.Collection<java.io.File> files)
Adds a collection of source files.
|
protected boolean |
checkFileForAndroidRes(java.io.File file)
Checks a file to make sure it is a valid file in the android res/asset folders.
|
protected void |
checkItems()
Checks for duplicate items across all source files.
|
protected com.android.ide.common.resources.DataSet<ResourceMergerItem,ResourceFile> |
createSet(java.lang.String name) |
java.io.File |
findMatchingSourceFile(java.io.File file)
Returns the longest path matching Source file that contains a given file.
|
java.lang.String |
getConfigName()
Returns the config name.
|
protected F |
getDataFile(java.io.File file) |
com.google.common.collect.ListMultimap<java.lang.String,I> |
getDataMap()
Returns a map of the items.
|
java.util.List<java.io.File> |
getSourceFiles()
Returns the list of source files.
|
protected boolean |
getValidateEnabled() |
boolean |
isEmpty()
Returns whether the set is empty of items.
|
boolean |
isIgnored(java.io.File file)
Returns whether the given file should be ignored.
|
F |
loadFile(java.io.File sourceFolder,
java.io.File dataFile,
com.android.utils.ILogger logger)
Loads a single dataFile from the given source folder (rather than load / parse from all
source folders).
|
void |
loadFromFiles(com.android.utils.ILogger logger)
Loads the DataSet from the files its source folders contain.
|
protected void |
processNewDataFile(java.io.File sourceFolder,
F dataFile,
boolean setTouched) |
void |
setIgnoredPatterns(java.lang.String aaptStylePattern) |
int |
size()
Returns the number of items.
|
java.lang.String |
toString() |
boolean |
updateWith(java.io.File sourceFolder,
java.io.File changedFile,
FileStatus fileStatus,
com.android.utils.ILogger logger)
Update the DataSet with a given file.
|
createFileAndItems, createFileAndItemsFromXml, equals, getLibraryName, getNamespace, handleChangedFile, handleNewFile, handleRemovedFile, hashCode, isFromDependency, isValidSourceFile, readSourceFolder, setCheckDuplicates, setDontNormalizeQualifiers, setFromDependency, setGeneratedSet, setPreprocessor, setShouldParseResourceIds, setTrackSourcePositionspublic static final java.lang.String ATTR_GENERATED
public GeneratedResourceSet(ResourceSet originalSet)
public GeneratedResourceSet(java.lang.String name,
com.android.ide.common.rendering.api.ResourceNamespace namespace,
java.lang.String libraryName)
protected com.android.ide.common.resources.DataSet<ResourceMergerItem,ResourceFile> createSet(java.lang.String name)
createSet in class ResourceSetpublic void loadFromFiles(com.android.utils.ILogger logger)
throws MergingException
MergingException - if something goes wrongpublic java.io.File findMatchingSourceFile(java.io.File file)
findMatchingSourceFile in interface SourceSetfile - the file to search forpublic void addSources(java.util.Collection<java.io.File> files)
files - the source files to add.public void addSource(java.io.File file)
file - the source file.@NonNull public java.util.List<java.io.File> getSourceFiles()
getSourceFiles in interface SourceSetpublic java.lang.String getConfigName()
public int size()
DataMappublic boolean isEmpty()
@NonNull public com.google.common.collect.ListMultimap<java.lang.String,I> getDataMap()
DataMap@Nullable
public F loadFile(@NonNull
java.io.File sourceFolder,
@NonNull
java.io.File dataFile,
@NonNull
com.android.utils.ILogger logger)
throws MergingException
Like loadFromFiles, all loaded items are set to TOUCHED.
sourceFolder - the source folderdataFile - the data file within source folderlogger - logs errorsMergingExceptionprotected void checkItems()
throws DuplicateDataException
DuplicateDataException - if a duplicated item is found.public boolean updateWith(java.io.File sourceFolder,
java.io.File changedFile,
FileStatus fileStatus,
com.android.utils.ILogger logger)
throws MergingException
sourceFolder - the sourceFile containing the changedFilechangedFile - The changed filefileStatus - the change stateMergingException - if something goes wrongprotected void processNewDataFile(@NonNull
java.io.File sourceFolder,
@NonNull
F dataFile,
boolean setTouched)
throws MergingException
MergingExceptionprotected void addItem(@NonNull
I item,
@Nullable
java.lang.String key)
throws MergingException
MergingExceptionprotected F getDataFile(@NonNull
java.io.File file)
public java.lang.String toString()
toString in class java.lang.Objectprotected boolean checkFileForAndroidRes(@NonNull
java.io.File file)
file - the file to checkpublic void setIgnoredPatterns(java.lang.String aaptStylePattern)
public boolean isIgnored(@NonNull
java.io.File file)
file - the file to checkprotected boolean getValidateEnabled()