mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-06 01:55:53 +01:00
fix: remove unused methods from Res* data classes
This commit is contained in:
parent
edb4fc86cc
commit
618d9b23e5
@ -58,27 +58,11 @@ public class ResPackage {
|
|||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ResType> getConfigs() {
|
|
||||||
return new ArrayList<ResType>(mConfigs.values());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasConfig(ResConfigFlags flags) {
|
|
||||||
return mConfigs.containsKey(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResType getConfig(ResConfigFlags flags) throws AndrolibException {
|
|
||||||
ResType config = mConfigs.get(flags);
|
|
||||||
if (config == null) {
|
|
||||||
throw new UndefinedResObjectException("config: " + flags);
|
|
||||||
}
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getResSpecCount() {
|
public int getResSpecCount() {
|
||||||
return mResSpecs.size();
|
return mResSpecs.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResType getOrCreateConfig(ResConfigFlags flags) throws AndrolibException {
|
public ResType getOrCreateConfig(ResConfigFlags flags) {
|
||||||
ResType config = mConfigs.get(flags);
|
ResType config = mConfigs.get(flags);
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
config = new ResType(flags);
|
config = new ResType(flags);
|
||||||
@ -87,14 +71,6 @@ public class ResPackage {
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ResTypeSpec> listTypes() {
|
|
||||||
return new ArrayList<ResTypeSpec>(mTypes.values());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasType(String typeName) {
|
|
||||||
return mTypes.containsKey(typeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResTypeSpec getType(String typeName) throws AndrolibException {
|
public ResTypeSpec getType(String typeName) throws AndrolibException {
|
||||||
ResTypeSpec type = mTypes.get(typeName);
|
ResTypeSpec type = mTypes.get(typeName);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
@ -151,7 +127,7 @@ public class ResPackage {
|
|||||||
return mSynthesizedRes.contains(resId);
|
return mSynthesizedRes.contains(resId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeResSpec(ResResSpec spec) throws AndrolibException {
|
public void removeResSpec(ResResSpec spec) {
|
||||||
mResSpecs.remove(spec.getId());
|
mResSpecs.remove(spec.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,13 +137,7 @@ public class ResPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addConfig(ResType config) throws AndrolibException {
|
public void addType(ResTypeSpec type) {
|
||||||
if (mConfigs.put(config.getFlags(), config) != null) {
|
|
||||||
throw new AndrolibException("Multiple configs: " + config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addType(ResTypeSpec type) throws AndrolibException {
|
|
||||||
if (mTypes.containsKey(type.getName())) {
|
if (mTypes.containsKey(type.getName())) {
|
||||||
LOGGER.warning("Multiple types detected! " + type + " ignored!");
|
LOGGER.warning("Multiple types detected! " + type + " ignored!");
|
||||||
} else {
|
} else {
|
||||||
@ -175,12 +145,6 @@ public class ResPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addResource(ResResource res) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeResource(ResResource res) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addSynthesizedRes(int resId) {
|
public void addSynthesizedRes(int resId) {
|
||||||
mSynthesizedRes.add(new ResID(resId));
|
mSynthesizedRes.add(new ResID(resId));
|
||||||
}
|
}
|
||||||
|
@ -64,14 +64,6 @@ public class ResResSpec {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasResource(ResType config) {
|
|
||||||
return hasResource(config.getFlags());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasResource(ResConfigFlags flags) {
|
|
||||||
return mResources.containsKey(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResResource getDefaultResource() throws AndrolibException {
|
public ResResource getDefaultResource() throws AndrolibException {
|
||||||
return getResource(new ResConfigFlags());
|
return getResource(new ResConfigFlags());
|
||||||
}
|
}
|
||||||
@ -80,10 +72,6 @@ public class ResResSpec {
|
|||||||
return mResources.containsKey(new ResConfigFlags());
|
return mResources.containsKey(new ResConfigFlags());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFullName() {
|
|
||||||
return getFullName(false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFullName(ResPackage relativeToPackage, boolean excludeType) {
|
public String getFullName(ResPackage relativeToPackage, boolean excludeType) {
|
||||||
return getFullName(getPackage().equals(relativeToPackage), excludeType);
|
return getFullName(getPackage().equals(relativeToPackage), excludeType);
|
||||||
}
|
}
|
||||||
@ -124,11 +112,6 @@ public class ResResSpec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeResource(ResResource res) throws AndrolibException {
|
|
||||||
ResConfigFlags flags = res.getConfig().getFlags();
|
|
||||||
mResources.remove(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return mId.toString() + " " + mType.toString() + "/" + mName;
|
return mId.toString() + " " + mType.toString() + "/" + mName;
|
||||||
|
@ -117,14 +117,6 @@ public class ResTable {
|
|||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPackage(int id) {
|
|
||||||
return mPackagesById.containsKey(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPackage(String name) {
|
|
||||||
return mPackagesByName.containsKey(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResValue getValue(String package_, String type, String name) throws AndrolibException {
|
public ResValue getValue(String package_, String type, String name) throws AndrolibException {
|
||||||
return getPackage(package_).getType(type).getResSpec(name).getDefaultResource().getValue();
|
return getPackage(package_).getType(type).getResSpec(name).getDefaultResource().getValue();
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,6 @@ public class ResType {
|
|||||||
this.mFlags = flags;
|
this.mFlags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<ResResource> listResources() {
|
|
||||||
return new LinkedHashSet<ResResource>(mResources.values());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResResource getResource(ResResSpec spec) throws AndrolibException {
|
public ResResource getResource(ResResSpec spec) throws AndrolibException {
|
||||||
ResResource res = mResources.get(spec);
|
ResResource res = mResources.get(spec);
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
@ -40,10 +36,6 @@ public class ResType {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<ResResSpec> listResSpecs() {
|
|
||||||
return mResources.keySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResConfigFlags getFlags() {
|
public ResConfigFlags getFlags() {
|
||||||
return mFlags;
|
return mFlags;
|
||||||
}
|
}
|
||||||
@ -52,11 +44,6 @@ public class ResType {
|
|||||||
addResource(res, false);
|
addResource(res, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeResource(ResResource res) throws AndrolibException {
|
|
||||||
ResResSpec spec = res.getResSpec();
|
|
||||||
mResources.remove(spec);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addResource(ResResource res, boolean overwrite) throws AndrolibException {
|
public void addResource(ResResource res, boolean overwrite) throws AndrolibException {
|
||||||
ResResSpec spec = res.getResSpec();
|
ResResSpec spec = res.getResSpec();
|
||||||
if (mResources.put(spec, res) != null && !overwrite) {
|
if (mResources.put(spec, res) != null && !overwrite) {
|
||||||
|
@ -52,18 +52,10 @@ public final class ResTypeSpec {
|
|||||||
return mId;
|
return mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEntryCount() {
|
|
||||||
return mEntryCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isString() {
|
public boolean isString() {
|
||||||
return mName.equalsIgnoreCase("string");
|
return mName.equalsIgnoreCase("string");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<ResResSpec> listResSpecs() {
|
|
||||||
return new LinkedHashSet<ResResSpec>(mResSpecs.values());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResResSpec getResSpec(String name) throws AndrolibException {
|
public ResResSpec getResSpec(String name) throws AndrolibException {
|
||||||
ResResSpec spec = getResSpecUnsafe(name);
|
ResResSpec spec = getResSpecUnsafe(name);
|
||||||
if (spec == null) {
|
if (spec == null) {
|
||||||
@ -76,7 +68,7 @@ public final class ResTypeSpec {
|
|||||||
return mResSpecs.get(name);
|
return mResSpecs.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeResSpec(ResResSpec spec) throws AndrolibException {
|
public void removeResSpec(ResResSpec spec) {
|
||||||
mResSpecs.remove(spec.getName());
|
mResSpecs.remove(spec.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,10 +45,6 @@ public class ResValuesFile {
|
|||||||
return mType;
|
return mType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResType getConfig() {
|
|
||||||
return mConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSynthesized(ResResource res) {
|
public boolean isSynthesized(ResResource res) {
|
||||||
return mPackage.isSynthesized(res.getResSpec().getId());
|
return mPackage.isSynthesized(res.getResSpec().getId());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user