use of com.android.ide.common.resources.ResourceRepository in project android_frameworks_base by DirtyUnicorns.
the class Main method setUp.
/**
* Initialize the bridge and the resource maps.
*/
@BeforeClass
public static void setUp() {
File data_dir = new File(PLATFORM_DIR, "data");
File res = new File(data_dir, "res");
sFrameworkRepo = new FrameworkResources(new FolderWrapper(res));
sFrameworkRepo.loadResources();
sFrameworkRepo.loadPublicResources(getLogger());
sProjectResources = new ResourceRepository(new FolderWrapper(TEST_RES_DIR + APP_TEST_RES), false) {
@NonNull
@Override
protected ResourceItem createResourceItem(@NonNull String name) {
return new ResourceItem(name);
}
};
sProjectResources.loadResources();
File fontLocation = new File(data_dir, "fonts");
File buildProp = new File(PLATFORM_DIR, "build.prop");
File attrs = new File(res, "values" + File.separator + "attrs.xml");
sBridge = new Bridge();
sBridge.init(ConfigGenerator.loadProperties(buildProp), fontLocation, ConfigGenerator.getEnumMap(attrs), getLayoutLog());
}
use of com.android.ide.common.resources.ResourceRepository in project android_frameworks_base by AOSPA.
the class Main method setUp.
/**
* Initialize the bridge and the resource maps.
*/
@BeforeClass
public static void setUp() {
File data_dir = new File(PLATFORM_DIR, "data");
File res = new File(data_dir, "res");
sFrameworkRepo = new FrameworkResources(new FolderWrapper(res));
sFrameworkRepo.loadResources();
sFrameworkRepo.loadPublicResources(getLogger());
sProjectResources = new ResourceRepository(new FolderWrapper(TEST_RES_DIR + APP_TEST_RES), false) {
@NonNull
@Override
protected ResourceItem createResourceItem(@NonNull String name) {
return new ResourceItem(name);
}
};
sProjectResources.loadResources();
File fontLocation = new File(data_dir, "fonts");
File buildProp = new File(PLATFORM_DIR, "build.prop");
File attrs = new File(res, "values" + File.separator + "attrs.xml");
sBridge = new Bridge();
sBridge.init(ConfigGenerator.loadProperties(buildProp), fontLocation, ConfigGenerator.getEnumMap(attrs), getLayoutLog());
}
use of com.android.ide.common.resources.ResourceRepository in project android_frameworks_base by ResurrectionRemix.
the class Main method setUp.
/**
* Initialize the bridge and the resource maps.
*/
@BeforeClass
public static void setUp() {
File data_dir = new File(PLATFORM_DIR, "data");
File res = new File(data_dir, "res");
sFrameworkRepo = new FrameworkResources(new FolderWrapper(res));
sFrameworkRepo.loadResources();
sFrameworkRepo.loadPublicResources(getLogger());
sProjectResources = new ResourceRepository(new FolderWrapper(TEST_RES_DIR + APP_TEST_RES), false) {
@NonNull
@Override
protected ResourceItem createResourceItem(@NonNull String name) {
return new ResourceItem(name);
}
};
sProjectResources.loadResources();
File fontLocation = new File(data_dir, "fonts");
File buildProp = new File(PLATFORM_DIR, "build.prop");
File attrs = new File(res, "values" + File.separator + "attrs.xml");
sBridge = new Bridge();
sBridge.init(ConfigGenerator.loadProperties(buildProp), fontLocation, ConfigGenerator.getEnumMap(attrs), getLayoutLog());
}
use of com.android.ide.common.resources.ResourceRepository in project android by JetBrains.
the class ResolutionUtils method getFolderConfiguration.
/**
* Gets the {@link FolderConfiguration} of a ResourceValue
* e.g. if we resolve a drawable using a mdpi configuration, yet that drawable only exists inside xhdpi, this method will return xhdpi
* @param configuration the FolderConfiguration that was used for resolving the ResourceValue
* @return the FolderConfiguration of the ResourceValue
*/
@NotNull
public static FolderConfiguration getFolderConfiguration(@NotNull AndroidFacet facet, @NotNull ResourceValue resolvedValue, @NotNull FolderConfiguration configuration) {
List<? extends Configurable> configurables;
if (resolvedValue.isFramework()) {
ConfigurationManager configurationManager = facet.getConfigurationManager();
// same as getHighestApiTarget();
IAndroidTarget target = configurationManager.getDefaultTarget();
assert target != null;
ResourceRepository resourceRepository = configurationManager.getResolverCache().getFrameworkResources(configuration, target);
assert resourceRepository != null;
ResourceItem resourceItem = resourceRepository.getResourceItem(resolvedValue.getResourceType(), resolvedValue.getName());
configurables = resourceItem.getSourceFileList();
} else {
AppResourceRepository appResourceRepository = facet.getAppResources(true);
configurables = appResourceRepository.getResourceItem(resolvedValue.getResourceType(), resolvedValue.getName());
}
Configurable configurable = configuration.findMatchingConfigurable(configurables);
assert configurable != null;
return configurable.getConfiguration();
}
use of com.android.ide.common.resources.ResourceRepository in project android_frameworks_base by crdroidandroid.
the class Main method setUp.
/**
* Initialize the bridge and the resource maps.
*/
@BeforeClass
public static void setUp() {
File data_dir = new File(PLATFORM_DIR, "data");
File res = new File(data_dir, "res");
sFrameworkRepo = new FrameworkResources(new FolderWrapper(res));
sFrameworkRepo.loadResources();
sFrameworkRepo.loadPublicResources(getLogger());
sProjectResources = new ResourceRepository(new FolderWrapper(TEST_RES_DIR + APP_TEST_RES), false) {
@NonNull
@Override
protected ResourceItem createResourceItem(@NonNull String name) {
return new ResourceItem(name);
}
};
sProjectResources.loadResources();
File fontLocation = new File(data_dir, "fonts");
File buildProp = new File(PLATFORM_DIR, "build.prop");
File attrs = new File(res, "values" + File.separator + "attrs.xml");
sBridge = new Bridge();
sBridge.init(ConfigGenerator.loadProperties(buildProp), fontLocation, ConfigGenerator.getEnumMap(attrs), getLayoutLog());
}
Aggregations