use of jadx.core.xmlgen.entry.ProtoValue in project jadx by skylot.
the class ResProtoParser method parse.
private void parse(String packageName, List<Type> types) {
for (Type type : types) {
String typeName = type.getName();
for (Entry entry : type.getEntryList()) {
int id = entry.getEntryId().getId();
String entryName = entry.getName();
for (ConfigValue configValue : entry.getConfigValueList()) {
String config = parse(configValue.getConfig());
ResourceEntry resEntry = new ResourceEntry(id, packageName, typeName, entryName, config);
resStorage.add(resEntry);
ProtoValue protoValue;
if (configValue.getValue().getValueCase() == Value.ValueCase.ITEM) {
protoValue = new ProtoValue(parse(configValue.getValue().getItem()));
} else {
protoValue = parse(configValue.getValue().getCompoundValue());
}
resEntry.setProtoValue(protoValue);
}
}
}
}
use of jadx.core.xmlgen.entry.ProtoValue in project jadx by skylot.
the class ResProtoParser method parse.
private ProtoValue parse(Attribute a) {
String format = XmlGenUtils.getAttrTypeAsString(a.getFormatFlags());
List<ProtoValue> namedValues = new ArrayList<>(a.getSymbolCount());
for (int i = 0; i < a.getSymbolCount(); i++) {
Attribute.Symbol s = a.getSymbol(i);
int type = s.getType();
String name = s.getName().getName();
String value = String.valueOf(s.getValue());
namedValues.add(new ProtoValue(value).setName(name).setType(type));
}
return new ProtoValue(format).setNamedValues(namedValues);
}
use of jadx.core.xmlgen.entry.ProtoValue in project jadx by skylot.
the class ResProtoParser method parse.
private ProtoValue parse(Plural p) {
List<ProtoValue> namedValues = new ArrayList<>(p.getEntryCount());
for (int i = 0; i < p.getEntryCount(); i++) {
Plural.Entry e = p.getEntry(i);
String name = e.getArity().name();
String value = parse(e.getItem());
namedValues.add(new ProtoValue(value).setName(name));
}
return new ProtoValue().setNamedValues(namedValues);
}
use of jadx.core.xmlgen.entry.ProtoValue in project jadx by skylot.
the class ResProtoParser method parse.
private ProtoValue parse(Styleable s) {
List<ProtoValue> namedValues = new ArrayList<>(s.getEntryCount());
for (int i = 0; i < s.getEntryCount(); i++) {
Styleable.Entry e = s.getEntry(i);
namedValues.add(new ProtoValue('@' + e.getAttr().getName()));
}
return new ProtoValue().setNamedValues(namedValues);
}
use of jadx.core.xmlgen.entry.ProtoValue in project jadx by skylot.
the class ResProtoParser method parse.
private ProtoValue parse(Array a) {
List<ProtoValue> namedValues = new ArrayList<>(a.getElementCount());
for (int i = 0; i < a.getElementCount(); i++) {
Array.Element e = a.getElement(i);
String value = parse(e.getItem());
namedValues.add(new ProtoValue(value));
}
return new ProtoValue().setNamedValues(namedValues);
}
Aggregations