本文整理汇总了Java中org.jetbrains.android.facet.AndroidFacet.getModuleResources方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidFacet.getModuleResources方法的具体用法?Java AndroidFacet.getModuleResources怎么用?Java AndroidFacet.getModuleResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jetbrains.android.facet.AndroidFacet
的用法示例。
在下文中一共展示了AndroidFacet.getModuleResources方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getViewClassNameFromLayoutReferenceTag
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private static String getViewClassNameFromLayoutReferenceTag(XmlTag tag, AndroidFacet facet) {
String layout = tag.getAttributeValue(SdkConstants.ATTR_LAYOUT);
if (layout == null) {
return null;
}
LocalResourceRepository moduleResources = facet.getModuleResources(false);
if (moduleResources == null) {
return null;
}
ResourceUrl resourceUrl = ResourceUrl.parse(layout);
if (resourceUrl == null || resourceUrl.type != ResourceType.LAYOUT) {
return null;
}
DataBindingInfo info = moduleResources.getDataBindingInfoForLayout(resourceUrl.name);
if (info == null) {
return null;
}
return info.getQualifiedName();
}
示例2: findClass
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
@Override
public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
if (!myComponent.hasAnyDataBindingEnabledFacet()) {
return null;
}
for (AndroidFacet facet : myComponent.getDataBindingEnabledFacets()) {
LocalResourceRepository moduleResources = facet.getModuleResources(false);
if (moduleResources == null) {
continue;
}
Map<String, DataBindingInfo> dataBindingResourceFiles = moduleResources.getDataBindingResourceFiles();
if (dataBindingResourceFiles == null) {
continue;
}
DataBindingInfo dataBindingInfo = dataBindingResourceFiles.get(qualifiedName);
if (dataBindingInfo == null) {
continue;
}
return DataBindingUtil.getOrCreatePsiClass(dataBindingInfo);
}
return null;
}
示例3: testParents
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
public void testParents() {
myFixture.copyFileToProject(LAYOUT, "res/layout/layout1.xml");
List<AndroidFacet> libraries = AndroidUtils.getAllAndroidDependencies(myModule, true);
assertEquals(2, libraries.size());
ModuleRootModificationUtil.addDependency(libraries.get(0).getModule(), libraries.get(1).getModule());
addArchiveLibraries();
ProjectResourceRepository repository = ProjectResourceRepository.create(myFacet);
assertEquals(3, repository.getChildCount());
Collection<String> items = repository.getItemsOfType(ResourceType.STRING);
assertTrue(items.isEmpty());
for (AndroidFacet facet : libraries) {
LocalResourceRepository moduleRepository = facet.getModuleResources(true);
assertNotNull(moduleRepository);
LocalResourceRepository moduleSetRepository = facet.getProjectResources(true);
assertNotNull(moduleSetRepository);
LocalResourceRepository librarySetRepository = facet.getAppResources(true);
assertNotNull(librarySetRepository);
}
myFacet.getModuleResources(true);
myFacet.getProjectResources(true);
myFacet.getAppResources(true);
}
示例4: getProjectResources
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
@Override
public AbstractResourceRepository getProjectResources(com.android.tools.lint.detector.api.Project project, boolean includeDependencies) {
final Module module = findModuleForLintProject(myProject, project);
if (module != null) {
AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null) {
return includeDependencies ? facet.getProjectResources(true) : facet.getModuleResources(true);
}
}
return null;
}
示例5: getModuleResources
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
/**
* Returns the Android resources specific to this module, not including resources in any
* dependent modules or any AAR libraries
*
* @param module the module to look up resources for
* @param createIfNecessary if true, create the app resources if necessary, otherwise only return if already computed
* @return the resource repository
*/
@Nullable
public static LocalResourceRepository getModuleResources(@NotNull Module module, boolean createIfNecessary) {
AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null) {
return facet.getModuleResources(createIfNecessary);
}
return null;
}
示例6: getStringResourceItem
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
private static ResourceItem getStringResourceItem(@NotNull AndroidFacet facet, @NotNull String key, @Nullable Locale locale) {
LocalResourceRepository repository = facet.getModuleResources(true);
// Ensure that items *just* created are processed by the resource repository
repository.sync();
List<ResourceItem> items = repository.getResourceItem(ResourceType.STRING, key);
if (items == null) {
return null;
}
for (ResourceItem item : items) {
FolderConfiguration config = item.getConfiguration();
LocaleQualifier qualifier = config == null ? null : config.getLocaleQualifier();
if (qualifier == null) {
if (locale == null) {
return item;
}
else {
continue;
}
}
Locale l = Locale.create(qualifier);
if (l.equals(locale)) {
return item;
}
}
return null;
}