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 resources Show documentation
Show all versions of resources Show documentation
An alternative Android testing framework.
package org.robolectric.res;
import java.util.List;
import javax.annotation.Nonnull;
import org.robolectric.manifest.AndroidManifest;
public class ResourceMerger {
@Nonnull
public 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 new ResourceTableFactory().newResourceTable(appManifest.getPackageName(),
allResourcePaths.toArray(new ResourcePath[allResourcePaths.size()]));
}
}