fix(res): XML "@null" decoding (#1583)(PR #1594)

minor improvements
This commit is contained in:
Jan S
2022-07-31 14:50:32 +02:00
committed by GitHub
parent 691d5cd1e6
commit ae2d4da585
3 changed files with 8 additions and 4 deletions
@@ -428,7 +428,9 @@ public class Deobfuscator {
return "Enum";
}
String result = "";
if (cls.getAccessFlags().isAbstract()) {
if (cls.getAccessFlags().isInterface()) {
result += "Interface";
} else if (cls.getAccessFlags().isAbstract()) {
result += "Abstract";
}
@@ -168,11 +168,13 @@ public class ResXmlGen {
private void addItem(ICodeWriter cw, String itemTag, String typeName, RawNamedValue value) {
String nameStr = vp.decodeNameRef(value.getNameRef());
String valueStr = vp.decodeValue(value.getRawValue());
int dataType = value.getRawValue().getDataType();
if (!typeName.equals("attr")) {
if (valueStr == null || valueStr.equals("0")) {
if (dataType == ParserConstants.TYPE_REFERENCE && (valueStr == null || valueStr.equals("0"))) {
valueStr = "@null";
}
if (nameStr != null) {
if (dataType == ParserConstants.TYPE_INT_DEC && nameStr != null) {
try {
int intVal = Integer.parseInt(valueStr);
String newVal = ManifestAttributes.getInstance().decode(nameStr.replace("android:attr.", ""), intVal);
@@ -411,7 +411,7 @@ public class MainWindow extends JFrame {
// check if project file already saved with default name
Path projectPath = getProjectPathForFile(singleFile);
if (Files.exists(projectPath)) {
LOG.info("Loading project for this file");
LOG.info("Loading project {}", projectPath);
openProject(projectPath, onFinish);
return true;
}