mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-09 10:14:25 +02: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");
|
serial.startTag(null, "resources");
|
||||||
|
|
||||||
for (ResResource res : valuesFile.listResources()) {
|
for (ResResource res : valuesFile.listResources()) {
|
||||||
|
if (valuesFile.isSynthesized(res)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
((ResXmlSerializable) res.getValue())
|
((ResXmlSerializable) res.getValue())
|
||||||
.serializeToXml(serial, res);
|
.serializeToXml(serial, res);
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ public class ResPackage {
|
|||||||
private final Set<ResResource> mFiles = new LinkedHashSet<ResResource>();
|
private final Set<ResResource> mFiles = new LinkedHashSet<ResResource>();
|
||||||
private final Map<Duo<ResType, ResConfig>, ResValuesFile> mValuesFiles =
|
private final Map<Duo<ResType, ResConfig>, ResValuesFile> mValuesFiles =
|
||||||
new LinkedHashMap<Duo<ResType, ResConfig>, ResValuesFile>();
|
new LinkedHashMap<Duo<ResType, ResConfig>, ResValuesFile>();
|
||||||
|
private final Set<ResID> mSynthesizedRes = new HashSet<ResID>();
|
||||||
|
|
||||||
private ResValueFactory mValueFactory;
|
private ResValueFactory mValueFactory;
|
||||||
|
|
||||||
@ -119,6 +120,10 @@ public class ResPackage {
|
|||||||
return mName;
|
return mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isSynthesized(ResID resId) {
|
||||||
|
return mSynthesizedRes.contains(resId);
|
||||||
|
}
|
||||||
|
|
||||||
public void addResSpec(ResResSpec spec) throws AndrolibException {
|
public void addResSpec(ResResSpec spec) throws AndrolibException {
|
||||||
if (mResSpecs.put(spec.getId(), spec) != null) {
|
if (mResSpecs.put(spec.getId(), spec) != null) {
|
||||||
throw new AndrolibException("Multiple resource specs: " + spec);
|
throw new AndrolibException("Multiple resource specs: " + spec);
|
||||||
@ -149,13 +154,17 @@ public class ResPackage {
|
|||||||
new Duo<ResType, ResConfig>(type, config);
|
new Duo<ResType, ResConfig>(type, config);
|
||||||
ResValuesFile values = mValuesFiles.get(key);
|
ResValuesFile values = mValuesFiles.get(key);
|
||||||
if (values == null) {
|
if (values == null) {
|
||||||
values = new ResValuesFile(type, config);
|
values = new ResValuesFile(this, type, config);
|
||||||
mValuesFiles.put(key, values);
|
mValuesFiles.put(key, values);
|
||||||
}
|
}
|
||||||
values.addResource(res);
|
values.addResource(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addSynthesizedRes(int resId) {
|
||||||
|
mSynthesizedRes.add(new ResID(resId));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return mName;
|
return mName;
|
||||||
|
@ -24,12 +24,14 @@ import java.util.Set;
|
|||||||
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||||
*/
|
*/
|
||||||
public class ResValuesFile {
|
public class ResValuesFile {
|
||||||
|
private final ResPackage mPackage;
|
||||||
private final ResType mType;
|
private final ResType mType;
|
||||||
private final ResConfig mConfig;
|
private final ResConfig mConfig;
|
||||||
private final Set<ResResource> mResources =
|
private final Set<ResResource> mResources =
|
||||||
new LinkedHashSet<ResResource>();
|
new LinkedHashSet<ResResource>();
|
||||||
|
|
||||||
public ResValuesFile(ResType type, ResConfig config) {
|
public ResValuesFile(ResPackage pkg, ResType type, ResConfig config) {
|
||||||
|
this.mPackage = pkg;
|
||||||
this.mType = type;
|
this.mType = type;
|
||||||
this.mConfig = config;
|
this.mConfig = config;
|
||||||
}
|
}
|
||||||
@ -53,6 +55,10 @@ public class ResValuesFile {
|
|||||||
return mConfig;
|
return mConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSynthesized(ResResource res) {
|
||||||
|
return mPackage.isSynthesized(res.getResSpec().getId());
|
||||||
|
}
|
||||||
|
|
||||||
public void addResource(ResResource res) {
|
public void addResource(ResResource res) {
|
||||||
mResources.add(res);
|
mResources.add(res);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user