Search in sources :

Example 1 with ProtoValue

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);
            }
        }
    }
}
Also used : Type(com.android.aapt.Resources.Type) ResourceEntry(jadx.core.xmlgen.entry.ResourceEntry) Entry(com.android.aapt.Resources.Entry) ConfigValue(com.android.aapt.Resources.ConfigValue) ResourceEntry(jadx.core.xmlgen.entry.ResourceEntry) ProtoValue(jadx.core.xmlgen.entry.ProtoValue)

Example 2 with 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);
}
Also used : Attribute(com.android.aapt.Resources.Attribute) ArrayList(java.util.ArrayList) ProtoValue(jadx.core.xmlgen.entry.ProtoValue)

Example 3 with ProtoValue

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);
}
Also used : ArrayList(java.util.ArrayList) Plural(com.android.aapt.Resources.Plural) ProtoValue(jadx.core.xmlgen.entry.ProtoValue)

Example 4 with ProtoValue

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);
}
Also used : ArrayList(java.util.ArrayList) Styleable(com.android.aapt.Resources.Styleable) ProtoValue(jadx.core.xmlgen.entry.ProtoValue)

Example 5 with ProtoValue

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);
}
Also used : Array(com.android.aapt.Resources.Array) ArrayList(java.util.ArrayList) ProtoValue(jadx.core.xmlgen.entry.ProtoValue)

Aggregations

ProtoValue (jadx.core.xmlgen.entry.ProtoValue)6 ArrayList (java.util.ArrayList)4 Array (com.android.aapt.Resources.Array)1 Attribute (com.android.aapt.Resources.Attribute)1 ConfigValue (com.android.aapt.Resources.ConfigValue)1 Entry (com.android.aapt.Resources.Entry)1 Plural (com.android.aapt.Resources.Plural)1 Styleable (com.android.aapt.Resources.Styleable)1 Type (com.android.aapt.Resources.Type)1 RawNamedValue (jadx.core.xmlgen.entry.RawNamedValue)1 ResourceEntry (jadx.core.xmlgen.entry.ResourceEntry)1