Switch to loop for checking extensions we are treating as raw

- 9patch (samsung)
 - regular (apple)
 - I imagine this list will grow over time
This commit is contained in:
Connor Tumbleson 2018-02-08 17:15:38 -05:00 committed by Connor Tumbleson
parent c7f4dfe1db
commit 085e8f66ef
No known key found for this signature in database
GPG Key ID: C3CC0A201EC7DA75

View File

@ -75,10 +75,12 @@ public class ResFileDecoder {
outFileName = outResName + ".r.9" + ext;
}
// check for samsung qmg & spi
if (inFileName.toLowerCase().endsWith(".qmg") || inFileName.toLowerCase().endsWith(".spi")) {
copyRaw(inDir, outDir, outFileName);
return;
// 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
@ -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
};
}