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>
|
<groupId>${project.groupId}</groupId>
|
||||||
<artifactId>apktool-lib</artifactId>
|
<artifactId>apktool-lib</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
@ -62,5 +68,11 @@
|
|||||||
<version>1.3.4-ibot7</version>
|
<version>1.3.4-ibot7</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-lang</groupId>
|
||||||
|
<artifactId>commons-lang</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
<type>jar</type>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -65,6 +65,11 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-lang</groupId>
|
||||||
|
<artifactId>commons-lang</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>brut.j</groupId>
|
<groupId>brut.j</groupId>
|
||||||
<artifactId>dir</artifactId>
|
<artifactId>dir</artifactId>
|
||||||
|
@ -16,12 +16,13 @@
|
|||||||
|
|
||||||
package brut.androlib.res.data.value;
|
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.AndrolibException;
|
||||||
import brut.androlib.res.data.ResResource;
|
import brut.androlib.res.data.ResResource;
|
||||||
|
import brut.androlib.res.xml.ResValuesXmlSerializable;
|
||||||
|
import brut.androlib.res.xml.ResXmlEncoders;
|
||||||
import brut.util.Duo;
|
import brut.util.Duo;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.xmlpull.v1.XmlSerializer;
|
import org.xmlpull.v1.XmlSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,9 +50,21 @@ public class ResPluralsValue extends ResBagValue implements ResValuesXmlSerializ
|
|||||||
if (item == null) {
|
if (item == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ResScalarValue rawValue = item;
|
||||||
|
|
||||||
serializer.startTag(null, "item");
|
serializer.startTag(null, "item");
|
||||||
serializer.attribute(null, "quantity", QUANTITY_MAP[i]);
|
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, "item");
|
||||||
}
|
}
|
||||||
serializer.endTag(null, "plurals");
|
serializer.endTag(null, "plurals");
|
||||||
|
@ -52,7 +52,7 @@ public abstract class ResScalarValue extends ResValue
|
|||||||
if (mRawValue != null) {
|
if (mRawValue != null) {
|
||||||
return mRawValue;
|
return mRawValue;
|
||||||
}
|
}
|
||||||
return encodeAsResXml();
|
return encodeAsResXmlValueExt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String encodeAsResXmlValueExt() throws AndrolibException {
|
public String encodeAsResXmlValueExt() throws AndrolibException {
|
||||||
@ -90,15 +90,16 @@ public abstract class ResScalarValue extends ResValue
|
|||||||
public void serializeToResValuesXml(XmlSerializer serializer, ResResource res)
|
public void serializeToResValuesXml(XmlSerializer serializer, ResResource res)
|
||||||
throws IOException, AndrolibException {
|
throws IOException, AndrolibException {
|
||||||
String type = res.getResSpec().getType().getName();
|
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();
|
String body = encodeAsResXmlValue();
|
||||||
|
|
||||||
|
|
||||||
/* check for resource reference */
|
/* check for resource reference */
|
||||||
if (body.contains("@")){
|
if (body.contains("@")){
|
||||||
// item = true;
|
if(!res.getFilePath().contains("string")) {
|
||||||
// messes up strings with @, need to check if strings.xml ignore
|
item = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for using attrib as node or item */
|
/* check for using attrib as node or item */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user