mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-20 16:57:34 +01:00
Added possibility to mark resource as synthesized, so it won't be included in value XMLs.
This commit is contained in:
parent
08a95d754c
commit
e9db0b3426
@ -212,7 +212,9 @@ final public class AndrolibResources {
|
||||
serial.startTag(null, "resources");
|
||||
|
||||
for (ResResource res : valuesFile.listResources()) {
|
||||
|
||||
if (valuesFile.isSynthesized(res)) {
|
||||
continue;
|
||||
}
|
||||
((ResXmlSerializable) res.getValue())
|
||||
.serializeToXml(serial, res);
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class ResPackage {
|
||||
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 ResValueFactory mValueFactory;
|
||||
|
||||
@ -119,6 +120,10 @@ public class ResPackage {
|
||||
return mName;
|
||||
}
|
||||
|
||||
boolean isSynthesized(ResID resId) {
|
||||
return mSynthesizedRes.contains(resId);
|
||||
}
|
||||
|
||||
public void addResSpec(ResResSpec spec) throws AndrolibException {
|
||||
if (mResSpecs.put(spec.getId(), spec) != null) {
|
||||
throw new AndrolibException("Multiple resource specs: " + spec);
|
||||
@ -149,13 +154,17 @@ public class ResPackage {
|
||||
new Duo<ResType, ResConfig>(type, config);
|
||||
ResValuesFile values = mValuesFiles.get(key);
|
||||
if (values == null) {
|
||||
values = new ResValuesFile(type, config);
|
||||
values = new ResValuesFile(this, type, config);
|
||||
mValuesFiles.put(key, values);
|
||||
}
|
||||
values.addResource(res);
|
||||
}
|
||||
}
|
||||
|
||||
public void addSynthesizedRes(int resId) {
|
||||
mSynthesizedRes.add(new ResID(resId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return mName;
|
||||
|
@ -24,12 +24,14 @@ import java.util.Set;
|
||||
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||
*/
|
||||
public class ResValuesFile {
|
||||
private final ResPackage mPackage;
|
||||
private final ResType mType;
|
||||
private final ResConfig mConfig;
|
||||
private final Set<ResResource> mResources =
|
||||
new LinkedHashSet<ResResource>();
|
||||
|
||||
public ResValuesFile(ResType type, ResConfig config) {
|
||||
public ResValuesFile(ResPackage pkg, ResType type, ResConfig config) {
|
||||
this.mPackage = pkg;
|
||||
this.mType = type;
|
||||
this.mConfig = config;
|
||||
}
|
||||
@ -53,6 +55,10 @@ public class ResValuesFile {
|
||||
return mConfig;
|
||||
}
|
||||
|
||||
public boolean isSynthesized(ResResource res) {
|
||||
return mPackage.isSynthesized(res.getResSpec().getId());
|
||||
}
|
||||
|
||||
public void addResource(ResResource res) {
|
||||
mResources.add(res);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user