|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.android.ide.common.res2.AbstractResourceRepository
public abstract class AbstractResourceRepository
Field Summary | |
---|---|
protected static java.lang.Object |
ITEM_MAP_LOCK
Lock used to protect map access |
Constructor Summary | |
---|---|
AbstractResourceRepository(boolean isFramework)
|
Method Summary | |
---|---|
void |
clear()
|
MergeConsumer<ResourceItem> |
createMergeConsumer()
|
java.util.List<com.android.resources.ResourceType> |
getAvailableResourceTypes()
|
java.util.Map<com.android.resources.ResourceType,java.util.Map<java.lang.String,com.android.ide.common.rendering.api.ResourceValue>> |
getConfiguredResources(FolderConfiguration referenceConfig)
Returns the resources values matching a given FolderConfiguration . |
java.util.Map<java.lang.String,com.android.ide.common.rendering.api.ResourceValue> |
getConfiguredResources(java.util.Map<com.android.resources.ResourceType,com.google.common.collect.ListMultimap<java.lang.String,ResourceItem>> itemMap,
com.android.resources.ResourceType type,
FolderConfiguration referenceConfig)
|
java.util.Map<java.lang.String,com.android.ide.common.rendering.api.ResourceValue> |
getConfiguredResources(com.android.resources.ResourceType type,
FolderConfiguration referenceConfig)
Returns a map of (resource name, resource value) for the given ResourceType . |
com.android.ide.common.rendering.api.ResourceValue |
getConfiguredValue(com.android.resources.ResourceType type,
java.lang.String name,
FolderConfiguration referenceConfig)
|
java.util.Map<com.android.resources.ResourceType,com.google.common.collect.ListMultimap<java.lang.String,ResourceItem>> |
getItems()
|
java.util.Collection<java.lang.String> |
getItemsOfType(com.android.resources.ResourceType type)
|
java.util.SortedSet<java.lang.String> |
getLanguages()
Returns the sorted list of languages used in the resources. |
protected abstract java.util.Map<com.android.resources.ResourceType,com.google.common.collect.ListMultimap<java.lang.String,ResourceItem>> |
getMap()
|
protected com.google.common.collect.ListMultimap<java.lang.String,ResourceItem> |
getMap(com.android.resources.ResourceType type)
|
protected abstract com.google.common.collect.ListMultimap<java.lang.String,ResourceItem> |
getMap(com.android.resources.ResourceType type,
boolean create)
|
ResourceFile |
getMatchingFile(java.lang.String name,
com.android.resources.ResourceType type,
FolderConfiguration config)
Returns the ResourceFile matching the given name, ResourceType and
configuration. |
java.util.SortedSet<java.lang.String> |
getRegions(java.lang.String currentLanguage)
Returns the sorted list of regions used in the resources with the given language. |
java.util.List<ResourceItem> |
getResourceItem(com.android.resources.ResourceType resourceType,
java.lang.String resourceName)
|
boolean |
hasResourceItem(com.android.resources.ResourceType resourceType,
java.lang.String resourceName)
Returns true if this resource repository contains a resource of the given name. |
boolean |
hasResourceItem(java.lang.String url)
Returns true if this resource repository contains a resource of the given name. |
boolean |
hasResourcesOfType(com.android.resources.ResourceType resourceType)
Returns whether the repository has resources of a given ResourceType . |
boolean |
isFramework()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.Object ITEM_MAP_LOCK
Constructor Detail |
---|
public AbstractResourceRepository(boolean isFramework)
Method Detail |
---|
public boolean isFramework()
@NonNull public MergeConsumer<ResourceItem> createMergeConsumer()
@NonNull protected abstract java.util.Map<com.android.resources.ResourceType,com.google.common.collect.ListMultimap<java.lang.String,ResourceItem>> getMap()
@Nullable protected abstract com.google.common.collect.ListMultimap<java.lang.String,ResourceItem> getMap(com.android.resources.ResourceType type, boolean create)
@NonNull protected com.google.common.collect.ListMultimap<java.lang.String,ResourceItem> getMap(com.android.resources.ResourceType type)
@NonNull public java.util.Map<com.android.resources.ResourceType,com.google.common.collect.ListMultimap<java.lang.String,ResourceItem>> getItems()
@Nullable public java.util.List<ResourceItem> getResourceItem(@NonNull com.android.resources.ResourceType resourceType, @NonNull java.lang.String resourceName)
@NonNull public java.util.Collection<java.lang.String> getItemsOfType(@NonNull com.android.resources.ResourceType type)
public boolean hasResourceItem(@NonNull java.lang.String url)
url
- the resource URL
public boolean hasResourceItem(@NonNull com.android.resources.ResourceType resourceType, @NonNull java.lang.String resourceName)
resourceType
- the type of resource to look upresourceName
- the name of the resource
public boolean hasResourcesOfType(@NonNull com.android.resources.ResourceType resourceType)
ResourceType
.
resourceType
- the type of resource to check.
@NonNull public java.util.List<com.android.resources.ResourceType> getAvailableResourceTypes()
@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 nametype
- the folder type search forconfig
- the folder configuration to match for
null
if no match was found.@NonNull public java.util.Map<com.android.resources.ResourceType,java.util.Map<java.lang.String,com.android.ide.common.rendering.api.ResourceValue>> getConfiguredResources(@NonNull FolderConfiguration referenceConfig)
FolderConfiguration
.
referenceConfig
- the configuration that each value must match.
ResourceType
@NonNull public java.util.Map<java.lang.String,com.android.ide.common.rendering.api.ResourceValue> getConfiguredResources(@NonNull com.android.resources.ResourceType type, @NonNull FolderConfiguration referenceConfig)
ResourceType
.
The values returned are taken from the resource files best matching a given
FolderConfiguration
.
type
- the type of the resources.referenceConfig
- the configuration to best match.@NonNull public java.util.Map<java.lang.String,com.android.ide.common.rendering.api.ResourceValue> getConfiguredResources(@NonNull java.util.Map<com.android.resources.ResourceType,com.google.common.collect.ListMultimap<java.lang.String,ResourceItem>> itemMap, @NonNull com.android.resources.ResourceType type, @NonNull FolderConfiguration referenceConfig)
@Nullable public com.android.ide.common.rendering.api.ResourceValue getConfiguredValue(@NonNull com.android.resources.ResourceType type, @NonNull java.lang.String name, @NonNull FolderConfiguration referenceConfig)
@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 clear()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |