Skip to content

Commit

Permalink
fix: use quantity attribute for plurals (PR #486)
Browse files Browse the repository at this point in the history
  • Loading branch information
tRuNKator authored and skylot committed Mar 22, 2019
1 parent d5f4266 commit 42b7843
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions jadx-core/src/main/java/jadx/core/xmlgen/ResXmlGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import jadx.core.xmlgen.entry.ResourceEntry;
import jadx.core.xmlgen.entry.ValuesParser;

import static jadx.core.xmlgen.ParserConstants.PLURALS_MAP;

public class ResXmlGen {

private static final Set<String> SKIP_RES_TYPES = new HashSet<>(Arrays.asList(
Expand Down Expand Up @@ -147,16 +149,22 @@ private void addItem(CodeWriter cw, String itemTag, String typeName, RawNamedVal
}
}
}
if (typeName.equals("attr")) {
if (nameStr != null) {
addSimpleValue(cw, typeName, itemTag, nameStr, valueStr, "");
}
} else if (typeName.equals("style")) {
if (nameStr != null) {
addSimpleValue(cw, typeName, itemTag, nameStr, "", valueStr);
}
} else {
addSimpleValue(cw, typeName, itemTag, null, null, valueStr);
switch (typeName) {
case "attr":
if (nameStr != null)
addSimpleValue(cw, typeName, itemTag, nameStr, valueStr, "");
break;
case "style":
if (nameStr != null)
addSimpleValue(cw, typeName, itemTag, nameStr, "", valueStr);
break;
case "plurals":
final String quantity = PLURALS_MAP.get(value.getNameRef());
addSimpleValue(cw, typeName, itemTag, "quantity", quantity, valueStr);
break;
default:
addSimpleValue(cw, typeName, itemTag, null, null, valueStr);
break;
}
}

Expand Down

0 comments on commit 42b7843

Please sign in to comment.