From 7c7387d032bec148ebb8fc3512da7125b261b638 Mon Sep 17 00:00:00 2001 From: isPointer Date: Thu, 11 Jun 2026 09:28:03 +0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- antik/src/main/java/com/antik/Main.java | 63 ++++++++----------------- 1 file changed, 19 insertions(+), 44 deletions(-) diff --git a/antik/src/main/java/com/antik/Main.java b/antik/src/main/java/com/antik/Main.java index 0f10645..6299ef0 100644 --- a/antik/src/main/java/com/antik/Main.java +++ b/antik/src/main/java/com/antik/Main.java @@ -78,8 +78,8 @@ public class Main { mergedApkFile = new File(output.get_out(inputApk, name)); System.out.println("[BUILD] Writing merged APK..."); - writeWithProgress(module, mergedApkFile); - System.out.println("\n[MERGE] APK merged successfully: " + mergedApkFile.getAbsolutePath()); + loading.progress(module, mergedApkFile); + System.out.println("[MERGE] APK merged successfully: " + mergedApkFile.getAbsolutePath()); } if (translatePath != null) { @@ -91,15 +91,15 @@ public class Main { String tn = mergedApkFile.getName(); int td = tn.lastIndexOf('.'); tn = (td > 0 ? tn.substring(0, td) : tn) + "_translated.apk"; - File transFile = new File(output.get_out(inputApk, tn)); - - System.out.println("[BUILD] Building Translated APK..."); - writeSilently(module, transFile); - System.out.println("[BUILD] Translated APK built at: " + transFile.getAbsolutePath()); - } else { - System.err.println("[ERROR] Translation file not found: " + translatePath); - } - } else if (!inputPath.endsWith(".apk")) { + File transFile = new File(output.get_out(inputApk, tn)); + + System.out.println("[BUILD] Building Translated APK..."); + output.write(module, transFile); + System.out.println("[BUILD] Translated APK built at: " + transFile.getAbsolutePath()); + } else { + System.err.println("[ERROR] Translation file not found: " + translatePath); + } + } else if (!inputPath.endsWith(".apk")) { // Default logging patch only if merging and no translation requested System.out.println("[INFO] Patching classes.dex for logging..."); try { @@ -111,13 +111,13 @@ public class Main { String pn = mergedApkFile.getName(); int pd = pn.lastIndexOf('.'); pn = (pd > 0 ? pn.substring(0, pd) : pn) + "_pairip.apk"; - File paiFile = new File(output.get_out(inputApk, pn)); - - System.out.println("[BUILD] Building Logging APK..."); - writeSilently(module, paiFile); - crc32.patch(mergedApkFile, paiFile); - System.out.println("[BUILD] Logging APK built at: " + paiFile.getAbsolutePath()); - } + File paiFile = new File(output.get_out(inputApk, pn)); + + System.out.println("[BUILD] Building Logging APK..."); + output.write(module, paiFile); + crc32.patch(mergedApkFile, paiFile); + System.out.println("[BUILD] Logging APK built at: " + paiFile.getAbsolutePath()); + } System.out.println("[BUILD] Process completed"); @@ -130,29 +130,4 @@ public class Main { } } } - - private static void writeWithProgress(ApkModule module, File file) throws IOException { - int total = module.getZipEntryMap().size(); - if (module.hasTableBlock()) { - total--; - } - int[] count = {0}; - final int finalTotal = total; - module.writeApk(file, new WriteProgress() { - @Override - public void onCompressFile(String path, int method, long length) { - count[0]++; - loading.progress(count[0], finalTotal); - } - }); - loading.progress(finalTotal, finalTotal); - } - - private static void writeSilently(ApkModule module, File file) throws IOException { - module.writeApk(file, new WriteProgress() { - @Override - public void onCompressFile(String path, int method, long length) { - } - }); - } -} +}