org.robolectric.res.ResourceMerger Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of robolectric-resources Show documentation
Show all versions of robolectric-resources Show documentation
An alternative Android testing framework.
package org.robolectric.res;
import org.jetbrains.annotations.NotNull;
import org.robolectric.manifest.AndroidManifest;
import java.util.ArrayList;
import java.util.List;
public class ResourceMerger {
@NotNull
public static PackageResourceTable buildResourceTable(AndroidManifest appManifest) {
ResourceRemapper resourceRemapper = new ResourceRemapper(appManifest.getRClass());
ResourcePath appResourcePath = appManifest.getResourcePath();
List allResourcePaths = appManifest.getIncludedResourcePaths();
for (ResourcePath resourcePath : allResourcePaths) {
if (!resourcePath.equals(appResourcePath) && resourcePath.getRClass() != null) {
resourceRemapper.remapRClass(resourcePath.getRClass());
}
}
return ResourceTableFactory.newResourceTable(appManifest.getPackageName(),
allResourcePaths.toArray(new ResourcePath[allResourcePaths.size()]));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy