mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-02 23:04:26 +02:00
Added public methods for factoring bag, string and reference values.
This commit is contained in:
parent
532bdaf74f
commit
4dbfecc003
@ -64,6 +64,13 @@ public class ResValueFactory {
|
|||||||
|
|
||||||
throw new AndrolibException("Invalid value type: "+ type);
|
throw new AndrolibException("Invalid value type: "+ type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResValue factory(String value) {
|
||||||
|
if (value.startsWith("res/")) {
|
||||||
|
return new ResFileValue(value);
|
||||||
|
}
|
||||||
|
return new ResStringValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
public ResValue factory(JniEntry entry) throws AndrolibException {
|
public ResValue factory(JniEntry entry) throws AndrolibException {
|
||||||
return factory(entry, false);
|
return factory(entry, false);
|
||||||
@ -108,33 +115,35 @@ public class ResValueFactory {
|
|||||||
entry.type, entry.name, String.valueOf(entry.valueType)));
|
entry.type, entry.name, String.valueOf(entry.valueType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResValue bagFactory(JniEntry entry)
|
public ResBagValue bagFactory(String type, int parent,
|
||||||
throws AndrolibException {
|
Map<ResReferenceValue, ResScalarValue> items) {
|
||||||
ResReferenceValue parent = newReference(entry.bagParent);
|
ResReferenceValue parentVal = newReference(parent);
|
||||||
Map<ResReferenceValue, ResScalarValue> items =
|
|
||||||
convertItems(entry.bagItems);
|
|
||||||
String type = entry.type;
|
|
||||||
|
|
||||||
if ("array".equals(type)) {
|
if ("array".equals(type)) {
|
||||||
return new ResArrayValue(parent, items);
|
return new ResArrayValue(parentVal, items);
|
||||||
}
|
}
|
||||||
if ("style".equals(type)) {
|
if ("style".equals(type)) {
|
||||||
return new ResStyleValue(parent, items);
|
return new ResStyleValue(parentVal, items);
|
||||||
}
|
}
|
||||||
if ("plurals".equals(type)) {
|
if ("plurals".equals(type)) {
|
||||||
return new ResPluralsValue(parent, items);
|
return new ResPluralsValue(parentVal, items);
|
||||||
}
|
}
|
||||||
if ("attr".equals(type)) {
|
if ("attr".equals(type)) {
|
||||||
return ResAttrFactory.factory(parent, items);
|
return ResAttrFactory.factory(parentVal, items);
|
||||||
}
|
}
|
||||||
return new ResBagValue(parent, items);
|
return new ResBagValue(parentVal, items);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResReferenceValue newReference(int resID) {
|
private ResValue bagFactory(JniEntry entry)
|
||||||
|
throws AndrolibException {
|
||||||
|
return bagFactory(entry.name, entry.bagParent, convertItems(entry.bagItems));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResReferenceValue newReference(int resID) {
|
||||||
return newReference(resID, false);
|
return newReference(resID, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResReferenceValue newReference(int resID, boolean theme) {
|
public ResReferenceValue newReference(int resID, boolean theme) {
|
||||||
return new ResReferenceValue(mPackage, resID, theme);
|
return new ResReferenceValue(mPackage, resID, theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user