mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-08 11:05:52 +01:00
ResPackage: generating list of files to decode and list of values*/* files on demand.
This commit is contained in:
parent
6576748f6b
commit
6c98d60922
@ -39,9 +39,6 @@ public class ResPackage {
|
|||||||
new LinkedHashMap<ResConfigFlags, ResConfig>();
|
new LinkedHashMap<ResConfigFlags, ResConfig>();
|
||||||
private final Map<String, ResType> mTypes =
|
private final Map<String, ResType> mTypes =
|
||||||
new LinkedHashMap<String, ResType>();
|
new LinkedHashMap<String, ResType>();
|
||||||
private final Set<ResResource> mFiles = new LinkedHashSet<ResResource>();
|
|
||||||
private final Map<Duo<ResType, ResConfig>, ResValuesFile> mValuesFiles =
|
|
||||||
new LinkedHashMap<Duo<ResType, ResConfig>, ResValuesFile>();
|
|
||||||
private final Set<ResID> mSynthesizedRes = new HashSet<ResID>();
|
private final Set<ResID> mSynthesizedRes = new HashSet<ResID>();
|
||||||
|
|
||||||
private ResValueFactory mValueFactory;
|
private ResValueFactory mValueFactory;
|
||||||
@ -111,11 +108,37 @@ public class ResPackage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Set<ResResource> listFiles() {
|
public Set<ResResource> listFiles() {
|
||||||
return mFiles;
|
Set<ResResource> ret = new HashSet<ResResource>();
|
||||||
|
for (ResResSpec spec : mResSpecs.values()) {
|
||||||
|
for (ResResource res : spec.listResources()) {
|
||||||
|
if (res.getValue() instanceof ResFileValue) {
|
||||||
|
ret.add(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ResValuesFile> listValuesFiles() {
|
public Collection<ResValuesFile> listValuesFiles() {
|
||||||
return mValuesFiles.values();
|
Map<Duo<ResType, ResConfig>, ResValuesFile> ret =
|
||||||
|
new HashMap<Duo<ResType, ResConfig>, ResValuesFile>();
|
||||||
|
for (ResResSpec spec : mResSpecs.values()) {
|
||||||
|
for (ResResource res : spec.listResources()) {
|
||||||
|
if (res.getValue() instanceof ResXmlSerializable) {
|
||||||
|
ResType type = res.getResSpec().getType();
|
||||||
|
ResConfig config = res.getConfig();
|
||||||
|
Duo<ResType, ResConfig> key =
|
||||||
|
new Duo<ResType, ResConfig>(type, config);
|
||||||
|
ResValuesFile values = ret.get(key);
|
||||||
|
if (values == null) {
|
||||||
|
values = new ResValuesFile(this, type, config);
|
||||||
|
ret.put(key, values);
|
||||||
|
}
|
||||||
|
values.addResource(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResTable getResTable() {
|
public ResTable getResTable() {
|
||||||
@ -153,22 +176,6 @@ public class ResPackage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addResource(ResResource res) {
|
public void addResource(ResResource res) {
|
||||||
ResValue value = res.getValue();
|
|
||||||
if (value instanceof ResFileValue) {
|
|
||||||
mFiles.add(res);
|
|
||||||
}
|
|
||||||
if (value instanceof ResXmlSerializable) {
|
|
||||||
ResType type = res.getResSpec().getType();
|
|
||||||
ResConfig config = res.getConfig();
|
|
||||||
Duo<ResType, ResConfig> key =
|
|
||||||
new Duo<ResType, ResConfig>(type, config);
|
|
||||||
ResValuesFile values = mValuesFiles.get(key);
|
|
||||||
if (values == null) {
|
|
||||||
values = new ResValuesFile(this, type, config);
|
|
||||||
mValuesFiles.put(key, values);
|
|
||||||
}
|
|
||||||
values.addResource(res);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSynthesizedRes(int resId) {
|
public void addSynthesizedRes(int resId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user