@Deprecated
public abstract class ResourceRepository
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<com.android.resources.ResourceFolderType,java.util.List<ResourceFolder>> |
mFolderMap
Deprecated.
|
protected java.util.Map<com.android.resources.ResourceType,java.util.Map<java.lang.String,ResourceItem>> |
mResourceMap
Deprecated.
|
| Modifier | Constructor and Description |
|---|---|
protected |
ResourceRepository(com.android.io.IAbstractFolder resFolder,
boolean isFrameworkRepository)
Deprecated.
Makes a resource repository.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Deprecated.
|
protected abstract ResourceItem |
createResourceItem(java.lang.String name)
Deprecated.
Creates a resource item with the given name.
|
protected java.util.Map<com.android.resources.ResourceType,ResourceValueMap> |
doGetConfiguredResources(FolderConfiguration referenceConfig)
Deprecated.
Returns the resources values matching a given
FolderConfiguration for the current
project. |
boolean |
ensureInitialized()
Deprecated.
Ensures that the repository has been initialized again after a call to
clear(). |
protected ResourceFile |
findResourceFile(java.io.File file)
Deprecated.
Looks up the
ResourceFile for the given File, if possible |
java.util.List<com.android.resources.ResourceType> |
getAvailableResourceTypes()
Deprecated.
|
java.util.Map<com.android.resources.ResourceType,ResourceValueMap> |
getConfiguredResources(FolderConfiguration referenceConfig)
Deprecated.
Returns the resources values matching a given
FolderConfiguration. |
java.util.List<ResourceFolder> |
getFolders(com.android.resources.ResourceFolderType type)
Deprecated.
Returns a list of
ResourceFolder for a specific ResourceFolderType. |
java.util.SortedSet<java.lang.String> |
getLanguages()
Deprecated.
Returns the sorted list of languages used in the resources.
|
ResourceFile |
getMatchingFile(java.lang.String name,
com.android.resources.ResourceFolderType type,
FolderConfiguration config)
Deprecated.
Returns the
ResourceFile matching the given name,
ResourceFolderType and configuration. |
ResourceFile |
getMatchingFile(java.lang.String name,
com.android.resources.ResourceType type,
FolderConfiguration config)
Deprecated.
Returns the
ResourceFile matching the given name,
ResourceType and configuration. |
java.util.SortedSet<java.lang.String> |
getRegions(java.lang.String currentLanguage)
Deprecated.
Returns the sorted list of regions used in the resources with the given language.
|
com.android.io.IAbstractFolder |
getResFolder()
Deprecated.
|
ResourceFolder |
getResourceFolder(com.android.io.IAbstractFolder folder)
Deprecated.
Returns the
ResourceFolder associated with a IAbstractFolder. |
ResourceItem |
getResourceItem(com.android.resources.ResourceType type,
java.lang.String name)
Deprecated.
Returns a
ResourceItem matching the given ResourceType and name. |
java.util.Collection<ResourceItem> |
getResourceItemsOfType(com.android.resources.ResourceType type)
Deprecated.
Returns a list of
ResourceItem matching a given ResourceType. |
java.util.List<ResourceFile> |
getSourceFiles(com.android.resources.ResourceType type,
java.lang.String name,
FolderConfiguration referenceConfig)
Deprecated.
Returns the list of source files for a given resource.
|
boolean |
hasResourceItem(com.android.resources.ResourceType type,
java.lang.String name)
Deprecated.
Returns true if this resource repository contains a resource of the given name.
|
boolean |
hasResourceItem(java.lang.String url)
Deprecated.
Returns true if this resource repository contains a resource of the given name.
|
boolean |
hasResourcesOfType(com.android.resources.ResourceType type)
Deprecated.
Returns whether the repository has resources of a given
ResourceType. |
boolean |
isFrameworkRepository()
Deprecated.
|
void |
loadResources()
Deprecated.
Loads the resources.
|
void |
postUpdateCleanUp()
Deprecated.
Cleans up the repository of resource items that have no source file anymore.
|
ResourceFolder |
processFolder(com.android.io.IAbstractFolder folder)
Deprecated.
Processes a folder and adds it to the list of existing folders.
|
protected void |
removeFile(java.util.Collection<com.android.resources.ResourceType> types,
ResourceFile file)
Deprecated.
|
protected void |
removeFile(com.android.resources.ResourceType type,
ResourceFile file)
Deprecated.
|
ResourceFolder |
removeFolder(com.android.resources.ResourceFolderType type,
com.android.io.IAbstractFolder removedFolder,
ScanningContext context)
Deprecated.
Removes a
ResourceFolder associated with the specified IAbstractFolder. |
protected java.util.Map<com.android.resources.ResourceFolderType,java.util.List<ResourceFolder>> mFolderMap
protected java.util.Map<com.android.resources.ResourceType,java.util.Map<java.lang.String,ResourceItem>> mResourceMap
protected ResourceRepository(@NonNull
com.android.io.IAbstractFolder resFolder,
boolean isFrameworkRepository)
resFolder - the resource folder of the repository.isFrameworkRepository - whether the repository is for framework resources.public com.android.io.IAbstractFolder getResFolder()
public boolean isFrameworkRepository()
public void clear()
public boolean ensureInitialized()
clear().@Nullable public ResourceFolder removeFolder(@NonNull com.android.resources.ResourceFolderType type, @NonNull com.android.io.IAbstractFolder removedFolder, @Nullable ScanningContext context)
ResourceFolder associated with the specified IAbstractFolder.type - The type of the folderremovedFolder - the IAbstractFolder object.context - the scanning contextResourceFolder that was removed, or null if no matches were found.public boolean hasResourceItem(@NonNull
java.lang.String url)
url - the resource URLpublic boolean hasResourceItem(@NonNull
com.android.resources.ResourceType type,
@NonNull
java.lang.String name)
type - the type of resource to look upname - the name of the resource@NonNull public ResourceItem getResourceItem(@NonNull com.android.resources.ResourceType type, @NonNull java.lang.String name)
ResourceItem matching the given ResourceType and name. If none
exist, it creates one.type - the resource typename - the name of the resource.@NonNull protected abstract ResourceItem createResourceItem(@NonNull java.lang.String name)
name - the name of the resource@Nullable public ResourceFolder processFolder(@NonNull com.android.io.IAbstractFolder folder)
folder - the folder to process@Nullable public java.util.List<ResourceFolder> getFolders(@NonNull com.android.resources.ResourceFolderType type)
ResourceFolder for a specific ResourceFolderType.type - The ResourceFolderType@NonNull public java.util.List<com.android.resources.ResourceType> getAvailableResourceTypes()
@NonNull public java.util.Collection<ResourceItem> getResourceItemsOfType(@NonNull com.android.resources.ResourceType type)
ResourceItem matching a given ResourceType.type - the type of the resource items to returnpublic boolean hasResourcesOfType(@NonNull
com.android.resources.ResourceType type)
ResourceType.type - the type of resource to check.@Nullable public ResourceFolder getResourceFolder(@NonNull com.android.io.IAbstractFolder folder)
ResourceFolder associated with a IAbstractFolder.folder - The IAbstractFolder object.ResourceFolder or null if it was not found.@Nullable public ResourceFile getMatchingFile(@NonNull java.lang.String name, @NonNull com.android.resources.ResourceFolderType type, @NonNull FolderConfiguration config)
ResourceFile matching the given name,
ResourceFolderType and configuration.
This only works with files generating one resource named after the file (for instance, layouts, bitmap based drawable, xml, anims).
name - the resource name or file nametype - the folder type search forconfig - the folder configuration to match fornull if no match was found.@Nullable public ResourceFile getMatchingFile(@NonNull java.lang.String name, @NonNull com.android.resources.ResourceType type, @NonNull FolderConfiguration config)
ResourceFile matching the given name,
ResourceType and configuration.
This only works with files generating one resource named after the file (for instance, layouts, bitmap based drawable, xml, anims).
name - the resource name or file nametype - the folder type search forconfig - the folder configuration to match fornull if no match was found.@Nullable protected ResourceFile findResourceFile(@NonNull java.io.File file)
ResourceFile for the given File, if possiblefile - the fileResourceFile, or null if not a known ResourceFile@Nullable public java.util.List<ResourceFile> getSourceFiles(@NonNull com.android.resources.ResourceType type, @NonNull java.lang.String name, @Nullable FolderConfiguration referenceConfig)
FolderConfiguration is given, then only the best
match for this config is returned.type - the type of the resource.name - the name of the resource.referenceConfig - an optional config for which only the best match will be returned.@NonNull public java.util.Map<com.android.resources.ResourceType,ResourceValueMap> getConfiguredResources(@NonNull FolderConfiguration referenceConfig)
FolderConfiguration.referenceConfig - the configuration that each value must match.ResourceType@NonNull protected final java.util.Map<com.android.resources.ResourceType,ResourceValueMap> doGetConfiguredResources(@NonNull FolderConfiguration referenceConfig)
FolderConfiguration for the current
project.referenceConfig - the configuration that each value must match.ResourceType@NonNull public java.util.SortedSet<java.lang.String> getLanguages()
@NonNull
public java.util.SortedSet<java.lang.String> getRegions(@NonNull
java.lang.String currentLanguage)
currentLanguage - the current language the region must be associated with.public void loadResources()
protected void removeFile(@NonNull
java.util.Collection<com.android.resources.ResourceType> types,
@NonNull
ResourceFile file)
protected void removeFile(@NonNull
com.android.resources.ResourceType type,
@NonNull
ResourceFile file)
public void postUpdateCleanUp()