All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.robolectric.res.ResourceMerger Maven / Gradle / Ivy

There is a newer version: 4.13
Show newest version
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()]));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy