use of com.android.tools.idea.res.ResourceFolderRepository in project android by JetBrains.
the class Parameter method existsResourceFile.
/**
* @deprecated Replaced by {@link AssetStudioUtils#resourceExists(AndroidProjectPaths, ResourceFolderType, String)}
* TODO: After Wizard migration, delete this
*/
public static boolean existsResourceFile(@Nullable SourceProvider sourceProvider, @Nullable Module module, @NotNull ResourceFolderType resourceFolderType, @NotNull ResourceType resourceType, @Nullable String name) {
if (name == null || name.isEmpty() || sourceProvider == null) {
return false;
}
AndroidFacet facet = module != null ? AndroidFacet.getInstance(module) : null;
for (File resDir : sourceProvider.getResDirectories()) {
if (facet != null) {
VirtualFile virtualResDir = VfsUtil.findFileByIoFile(resDir, false);
if (virtualResDir != null) {
ResourceFolderRepository folderRepository = ResourceFolderRegistry.get(facet, virtualResDir);
List<ResourceItem> resourceItemList = folderRepository.getResourceItem(resourceType, name);
if (resourceItemList != null && !resourceItemList.isEmpty()) {
return true;
}
}
} else if (existsResourceFile(resDir, resourceFolderType, name)) {
return true;
}
}
return false;
}
Aggregations