mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-07 18:45:58 +01:00
refactor: remove duplicated code
This commit is contained in:
parent
bb2acaf3e1
commit
4d11c13e44
@ -813,7 +813,7 @@ final public class AndrolibResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (id == 1) {
|
if (id == 1) {
|
||||||
try (InputStream in = AndrolibResources.class.getResourceAsStream("/brut/androlib/android-framework.jar");
|
try (InputStream in = getAndroidFrameworkResourcesAsStream();
|
||||||
OutputStream out = new FileOutputStream(apk)) {
|
OutputStream out = new FileOutputStream(apk)) {
|
||||||
IOUtils.copy(in, out);
|
IOUtils.copy(in, out);
|
||||||
return apk;
|
return apk;
|
||||||
@ -946,8 +946,7 @@ final public class AndrolibResources {
|
|||||||
publicizeResources(arsc, ARSCDecoder.decode(new ByteArrayInputStream(arsc), true, true).getFlagsOffsets());
|
publicizeResources(arsc, ARSCDecoder.decode(new ByteArrayInputStream(arsc), true, true).getFlagsOffsets());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void publicizeResources(byte[] arsc, FlagsOffset[] flagsOffsets)
|
public void publicizeResources(byte[] arsc, FlagsOffset[] flagsOffsets) {
|
||||||
throws AndrolibException {
|
|
||||||
for (FlagsOffset flags : flagsOffsets) {
|
for (FlagsOffset flags : flagsOffsets) {
|
||||||
int offset = flags.offset + 3;
|
int offset = flags.offset + 3;
|
||||||
int end = offset + 4 * flags.count;
|
int end = offset + 4 * flags.count;
|
||||||
@ -1031,12 +1030,8 @@ final public class AndrolibResources {
|
|||||||
return apkOptions.isAapt2() ? 2 : 1;
|
return apkOptions.isAapt2() ? 2 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getAndroidResourcesFile() throws AndrolibException {
|
public InputStream getAndroidFrameworkResourcesAsStream() {
|
||||||
try {
|
return Jar.class.getResourceAsStream("/brut/androlib/android-framework.jar");
|
||||||
return Jar.getResourceAsFile("/brut/androlib/android-framework.jar");
|
|
||||||
} catch (BrutException ex) {
|
|
||||||
throw new AndrolibException(ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
|
Loading…
Reference in New Issue
Block a user