diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncoders.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncoders.java index e43cb8870b..d45434ceed 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncoders.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncoders.java @@ -143,12 +143,12 @@ public static String encodeAsXmlValue(String str) { } public static boolean hasMultipleNonPositionalSubstitutions(String str) { - Duo, List> tuple = findSubstitutions(str, 3); + Duo, List> tuple = findSubstitutions(str, 4); return ! tuple.m1.isEmpty() && tuple.m1.size() + tuple.m2.size() > 1; } public static String enumerateNonPositionalSubstitutionsIfRequired(String str) { - Duo, List> tuple = findSubstitutions(str, 3); + Duo, List> tuple = findSubstitutions(str, 4); if (tuple.m1.isEmpty() || tuple.m1.size() + tuple.m2.size() < 2) { return str; } diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/PositionalEnumerationTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/PositionalEnumerationTest.java index 18a5254699..eb2f3d969a 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/PositionalEnumerationTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/PositionalEnumerationTest.java @@ -51,6 +51,16 @@ public void threePositionalArgumentsTest() { assertEquals(" %1$s, %2$s and %3$d other", enumerateArguments(" %1$s, %2$s and %3$d other")); } + @Test + public void fourArgumentsTest() { + assertEquals("%1$s, %2$s, and %3$d other and %4$d.", enumerateArguments("%s, %s, and %d other and %d.")); + } + + @Test + public void fourPositionalArgumentsTest() { + assertEquals(" %1$s, %2$s and %3$d other and %4$d.", enumerateArguments(" %1$s, %2$s and %3$d other and %4$d.")); + } + private String enumerateArguments(String value) { return ResXmlEncoders.enumerateNonPositionalSubstitutionsIfRequired(value); }