diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResPackage.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResPackage.java index 7bbbf3f4..5530bee5 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResPackage.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResPackage.java @@ -81,8 +81,7 @@ public class ResPackage { return mResSpecs.size(); } - public ResType getOrCreateConfig(ResConfigFlags flags) - throws AndrolibException { + public ResType getOrCreateConfig(ResConfigFlags flags) throws AndrolibException { ResType config = mConfigs.get(flags); if (config == null) { config = new ResType(flags); @@ -126,8 +125,7 @@ public class ResPackage { if (res.getValue() instanceof ResValuesXmlSerializable) { ResTypeSpec type = res.getResSpec().getType(); ResType config = res.getConfig(); - Duo key = new Duo( - type, config); + Duo key = new Duo(type, config); ResValuesFile values = ret.get(key); if (values == null) { values = new ResValuesFile(this, type, config); @@ -204,9 +202,7 @@ public class ResPackage { return false; } final ResPackage other = (ResPackage) obj; - if (this.mResTable != other.mResTable - && (this.mResTable == null || !this.mResTable - .equals(other.mResTable))) { + if (this.mResTable != other.mResTable && (this.mResTable == null || !this.mResTable.equals(other.mResTable))) { return false; } if (this.mId != other.mId) { @@ -218,8 +214,7 @@ public class ResPackage { @Override public int hashCode() { int hash = 17; - hash = 31 * hash - + (this.mResTable != null ? this.mResTable.hashCode() : 0); + hash = 31 * hash + (this.mResTable != null ? this.mResTable.hashCode() : 0); hash = 31 * hash + this.mId; return hash; } @@ -231,6 +226,5 @@ public class ResPackage { return mValueFactory; } - private final static Logger LOGGER = Logger - .getLogger(ResPackage.class.getName()); + private final static Logger LOGGER = Logger.getLogger(ResPackage.class.getName()); } diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResSpec.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResSpec.java index 78d459e6..f227e553 100755 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResSpec.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResSpec.java @@ -46,12 +46,10 @@ public class ResResSpec { return getResource(config.getFlags()); } - public ResResource getResource(ResConfigFlags config) - throws AndrolibException { + public ResResource getResource(ResConfigFlags config) throws AndrolibException { ResResource res = mResources.get(config); if (res == null) { - throw new UndefinedResObject(String.format( - "resource: spec=%s, config=%s", this, config)); + throw new UndefinedResObject(String.format("resource: spec=%s, config=%s", this, config)); } return res; } @@ -109,12 +107,10 @@ public class ResResSpec { addResource(res, false); } - public void addResource(ResResource res, boolean overwrite) - throws AndrolibException { + public void addResource(ResResource res, boolean overwrite) throws AndrolibException { ResConfigFlags flags = res.getConfig().getFlags(); if (mResources.put(flags, res) != null && !overwrite) { - throw new AndrolibException(String.format( - "Multiple resources: spec=%s, config=%s", this, flags)); + throw new AndrolibException(String.format("Multiple resources: spec=%s, config=%s", this, flags)); } } diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResource.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResource.java index c89dd976..cf70aa49 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResource.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResource.java @@ -34,8 +34,7 @@ public class ResResource { } public String getFilePath() { - return mResSpec.getType().getName() - + mConfig.getFlags().getQualifiers() + "/" + mResSpec.getName(); + return mResSpec.getType().getName() + mConfig.getFlags().getQualifiers() + "/" + mResSpec.getName(); } public ResType getConfig() { diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTable.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTable.java index 15bdb0ca..2d56363a 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTable.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTable.java @@ -87,8 +87,8 @@ public class ResTable { public ResPackage getHighestSpecPackage() throws AndrolibException { int id = 0; int value = 0; - for(ResPackage resPackage : mPackagesById.values()) { - if(resPackage.getResSpecCount() > value && !resPackage.getName().equalsIgnoreCase("android")) { + for (ResPackage resPackage : mPackagesById.values()) { + if (resPackage.getResSpecCount() > value && !resPackage.getName().equalsIgnoreCase("android")) { value = resPackage.getResSpecCount(); id = resPackage.getId(); } @@ -123,18 +123,14 @@ public class ResTable { return mPackagesByName.containsKey(name); } - public ResValue getValue(String package_, String type, String name) - throws AndrolibException { - return getPackage(package_).getType(type).getResSpec(name) - .getDefaultResource().getValue(); + public ResValue getValue(String package_, String type, String name) throws AndrolibException { + return getPackage(package_).getType(type).getResSpec(name).getDefaultResource().getValue(); } - public void addPackage(ResPackage pkg, boolean main) - throws AndrolibException { + public void addPackage(ResPackage pkg, boolean main) throws AndrolibException { Integer id = pkg.getId(); if (mPackagesById.containsKey(id)) { - throw new AndrolibException("Multiple packages: id=" - + id.toString()); + throw new AndrolibException("Multiple packages: id=" + id.toString()); } String name = pkg.getName(); if (mPackagesByName.containsKey(name)) { diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResType.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResType.java index e0669d23..7cb9f3a9 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResType.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResType.java @@ -38,8 +38,7 @@ public class ResType { public ResResource getResource(ResResSpec spec) throws AndrolibException { ResResource res = mResources.get(spec); if (res == null) { - throw new UndefinedResObject(String.format( - "resource: spec=%s, config=%s", spec, this)); + throw new UndefinedResObject(String.format("resource: spec=%s, config=%s", spec, this)); } return res; } @@ -61,12 +60,10 @@ public class ResType { 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(); if (mResources.put(spec, res) != null && !overwrite) { - throw new AndrolibException(String.format( - "Multiple resources: spec=%s, config=%s", spec, this)); + throw new AndrolibException(String.format("Multiple resources: spec=%s, config=%s", spec, this)); } } diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTypeSpec.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTypeSpec.java index 7772ebae..4452bbc4 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTypeSpec.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTypeSpec.java @@ -64,8 +64,7 @@ public final class ResTypeSpec { public ResResSpec getResSpec(String name) throws AndrolibException { ResResSpec spec = mResSpecs.get(name); if (spec == null) { - throw new UndefinedResObject(String.format("resource spec: %s/%s", - getName(), name)); + throw new UndefinedResObject(String.format("resource spec: %s/%s", getName(), name)); } return spec; } @@ -76,8 +75,7 @@ public final class ResTypeSpec { public void addResSpec(ResResSpec spec) throws AndrolibException { if (mResSpecs.put(spec.getName(), spec) != null) { - throw new AndrolibException(String.format( - "Multiple res specs: %s/%s", getName(), spec.getName())); + throw new AndrolibException(String.format("Multiple res specs: %s/%s", getName(), spec.getName())); } } diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResValuesFile.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResValuesFile.java index 63b22a0c..7d140d94 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResValuesFile.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResValuesFile.java @@ -69,12 +69,10 @@ public class ResValuesFile { return false; } final ResValuesFile other = (ResValuesFile) obj; - if (this.mType != other.mType - && (this.mType == null || !this.mType.equals(other.mType))) { + if (this.mType != other.mType && (this.mType == null || !this.mType.equals(other.mType))) { return false; } - if (this.mConfig != other.mConfig - && (this.mConfig == null || !this.mConfig.equals(other.mConfig))) { + if (this.mConfig != other.mConfig && (this.mConfig == null || !this.mConfig.equals(other.mConfig))) { return false; } return true; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValueFactory.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValueFactory.java index a8bb9453..c77935e9 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValueFactory.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValueFactory.java @@ -27,12 +27,11 @@ import brut.util.Duo; public class ResValueFactory { private final ResPackage mPackage; - public ResValueFactory(ResPackage pakage_) { - this.mPackage = pakage_; + public ResValueFactory(ResPackage package_) { + this.mPackage = package_; } - public ResScalarValue factory(int type, int value, String rawValue) - throws AndrolibException { + public ResScalarValue factory(int type, int value, String rawValue) throws AndrolibException { switch (type) { case TypedValue.TYPE_NULL: if (value == TypedValue.DATA_NULL_EMPTY) { // Special case $empty as explicitly defined empty value @@ -57,12 +56,10 @@ public class ResValueFactory { return newReference(value, rawValue); } - if (type >= TypedValue.TYPE_FIRST_COLOR_INT - && type <= TypedValue.TYPE_LAST_COLOR_INT) { + if (type >= TypedValue.TYPE_FIRST_COLOR_INT && type <= TypedValue.TYPE_LAST_COLOR_INT) { return new ResColorValue(value, rawValue); } - if (type >= TypedValue.TYPE_FIRST_INT - && type <= TypedValue.TYPE_LAST_INT) { + if (type >= TypedValue.TYPE_FIRST_INT && type <= TypedValue.TYPE_LAST_INT) { return new ResIntValue(value, rawValue, type); } @@ -76,8 +73,7 @@ public class ResValueFactory { return new ResStringValue(value, rawValue); } - public ResBagValue bagFactory(int parent, - Duo[] items) throws AndrolibException { + public ResBagValue bagFactory(int parent, Duo[] items) throws AndrolibException { ResReferenceValue parentVal = newReference(parent, null); if (items.length == 0) { @@ -90,8 +86,7 @@ public class ResValueFactory { if (key == ResArrayValue.BAG_KEY_ARRAY_START) { return new ResArrayValue(parentVal, items); } - if (key >= ResPluralsValue.BAG_KEY_PLURALS_START - && key <= ResPluralsValue.BAG_KEY_PLURALS_END) { + if (key >= ResPluralsValue.BAG_KEY_PLURALS_START && key <= ResPluralsValue.BAG_KEY_PLURALS_END) { return new ResPluralsValue(parentVal, items); } return new ResStyleValue(parentVal, items, this); @@ -101,8 +96,7 @@ public class ResValueFactory { return newReference(resID, rawValue, false); } - public ResReferenceValue newReference(int resID, String rawValue, - boolean theme) { + public ResReferenceValue newReference(int resID, String rawValue, boolean theme) { return new ResReferenceValue(mPackage, resID, rawValue, theme); } } \ No newline at end of file diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java index 258c4d3a..497433f3 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java @@ -289,8 +289,7 @@ public class ARSCDecoder { : mPkg.getValueFactory().factory(type, data, null); } - private ResConfigFlags readConfigFlags() throws IOException, - AndrolibException { + private ResConfigFlags readConfigFlags() throws IOException, AndrolibException { int size = mIn.readInt(); int read = 28; @@ -465,8 +464,7 @@ public class ARSCDecoder { } } - private void nextChunkCheckType(int expectedType) throws IOException, - AndrolibException { + private void nextChunkCheckType(int expectedType) throws IOException, AndrolibException { nextChunk(); checkChunkType(expectedType); }