Switch to loop for checking extensions we are treating as raw
- 9patch (samsung)
- regular (apple)
- I imagine this list will grow over time
@@ -75,11 +75,13 @@ public class ResFileDecoder {
outFileName = outResName + ".r.9" + ext;
}
- // check for samsung qmg & spi
- if (inFileName.toLowerCase().endsWith(".qmg") || inFileName.toLowerCase().endsWith(".spi")) {
+ // check for raw 9patch images
+ for (String extension : RAW_9PATCH_IMAGE_EXTENSIONS) {
+ if (inFileName.toLowerCase().endsWith("." + extension)) {
copyRaw(inDir, outDir, outFileName);
return;
}
+ }
// check for xml 9 patches which are just xml files
if (inFileName.toLowerCase().endsWith(".xml")) {
@@ -100,6 +102,15 @@ public class ResFileDecoder {
outFileName = outResName + ext;
}
}
+
+ // check for raw image
+ for (String extension : RAW_IMAGE_EXTENSIONS) {
+ if (inFileName.toLowerCase().endsWith("." + extension)) {
+ copyRaw(inDir, outDir, outFileName);
+ return;
+ }
+ }
+
if (!".xml".equals(ext)) {
decode(inDir, inFileName, outDir, outFileName, "raw");
return;
@@ -148,4 +159,13 @@ public class ResFileDecoder {
}
private final static Logger LOGGER = Logger.getLogger(ResFileDecoder.class.getName());
+
+ private final static String[] RAW_IMAGE_EXTENSIONS = new String[] {
+ "m4a", // apple
+ };
+
+ private final static String[] RAW_9PATCH_IMAGE_EXTENSIONS = new String[] {
+ "qmg", // samsung
+ "spi", // samsung
+ };
}
