1 package org.robolectric.res; 2 3 public class FileTypedResource extends TypedResource<String> { 4 private final FsFile fsFile; 5 FileTypedResource(FsFile fsFile, ResType resType, XmlContext xmlContext)6 public FileTypedResource(FsFile fsFile, ResType resType, XmlContext xmlContext) { 7 super(fsFile.getPath(), resType, xmlContext); 8 9 this.fsFile = fsFile; 10 } 11 isFile()12 @Override public boolean isFile() { 13 return true; 14 } 15 getFsFile()16 public FsFile getFsFile() { 17 return fsFile; 18 } 19 20 @Override isXml()21 public boolean isXml() { 22 return fsFile.getName().endsWith("xml"); 23 } 24 25 public static class Image extends FileTypedResource { 26 private final boolean isNinePatch; 27 Image(FsFile fsFile, boolean isNinePatch, XmlContext xmlContext)28 public Image(FsFile fsFile, boolean isNinePatch, XmlContext xmlContext) { 29 super(fsFile, ResType.DRAWABLE, xmlContext); 30 this.isNinePatch = isNinePatch; 31 } 32 isNinePatch()33 public boolean isNinePatch() { 34 return isNinePatch; 35 } 36 } 37 } 38