mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-02 06:54:25 +02:00
working on adding new plurals fix thanks to @miuirussia
This commit is contained in:
parent
1e78f27dbd
commit
6f9b83d196
@ -49,6 +49,12 @@
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>apktool-lib</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>common</artifactId>
|
||||
@ -62,5 +68,11 @@
|
||||
<version>1.3.4-ibot7</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.4</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -65,6 +65,11 @@
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>brut.j</groupId>
|
||||
<artifactId>dir</artifactId>
|
||||
|
@ -16,12 +16,13 @@
|
||||
|
||||
package brut.androlib.res.data.value;
|
||||
|
||||
import brut.androlib.res.xml.ResValuesXmlSerializable;
|
||||
import brut.androlib.res.xml.ResXmlEncoders;
|
||||
import brut.androlib.AndrolibException;
|
||||
import brut.androlib.res.data.ResResource;
|
||||
import brut.androlib.res.xml.ResValuesXmlSerializable;
|
||||
import brut.androlib.res.xml.ResXmlEncoders;
|
||||
import brut.util.Duo;
|
||||
import java.io.IOException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
/**
|
||||
@ -49,9 +50,21 @@ public class ResPluralsValue extends ResBagValue implements ResValuesXmlSerializ
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ResScalarValue rawValue = item;
|
||||
|
||||
serializer.startTag(null, "item");
|
||||
serializer.attribute(null, "quantity", QUANTITY_MAP[i]);
|
||||
serializer.text(item.encodeAsResXmlValue());
|
||||
if (ResXmlEncoders.hasMultipleNonPositionalSubstitutions(rawValue.encodeAsResXmlValue())) {
|
||||
serializer.text(item.encodeAsResXmlValueExt());
|
||||
} else {
|
||||
String recode = item.encodeAsResXmlValue();
|
||||
//Dirty, but working fix @miuirussia
|
||||
for (int j = 0; j < 10; j++) {
|
||||
recode = StringUtils.replace(recode, "%" + Integer.toString(j) + "$" + Integer.toString(j) + "$", "%" + Integer.toString(j) + "$");
|
||||
}
|
||||
serializer.text(recode);
|
||||
}
|
||||
serializer.endTag(null, "item");
|
||||
}
|
||||
serializer.endTag(null, "plurals");
|
||||
|
@ -52,7 +52,7 @@ public abstract class ResScalarValue extends ResValue
|
||||
if (mRawValue != null) {
|
||||
return mRawValue;
|
||||
}
|
||||
return encodeAsResXml();
|
||||
return encodeAsResXmlValueExt();
|
||||
}
|
||||
|
||||
public String encodeAsResXmlValueExt() throws AndrolibException {
|
||||
@ -90,15 +90,16 @@ public abstract class ResScalarValue extends ResValue
|
||||
public void serializeToResValuesXml(XmlSerializer serializer, ResResource res)
|
||||
throws IOException, AndrolibException {
|
||||
String type = res.getResSpec().getType().getName();
|
||||
boolean item = ! "reference".equals(mType) && ! type.equals(mType);
|
||||
boolean item = !"reference".equals(mType) && !type.equals(mType);
|
||||
|
||||
String body = encodeAsResXmlValue();
|
||||
|
||||
|
||||
/* check for resource reference */
|
||||
if (body.contains("@")){
|
||||
// item = true;
|
||||
// messes up strings with @, need to check if strings.xml ignore
|
||||
if(!res.getFilePath().contains("string")) {
|
||||
item = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* check for using attrib as node or item */
|
||||
|
Loading…
x
Reference in New Issue
Block a user