diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 38211bda..6e0d8a87 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -11,7 +11,7 @@ android { minSdk = 21 targetSdk = 35 versionCode = 38 - versionName = "2.0.7" + versionName = "2.0.8" } buildTypes { @@ -38,7 +38,6 @@ android { implementation("androidx.appcompat:appcompat:1.7.0") implementation("androidx.core:core-ktx:1.13.1") implementation("androidx.constraintlayout:constraintlayout:2.1.4") - implementation("androidx.multidex:multidex:2.0.1") implementation("androidx.coordinatorlayout:coordinatorlayout:1.2.0") implementation("com.google.android.material:material:1.12.0") } diff --git a/app/src/main/java/com/abdurazaaqmohammed/AntiSplit/main/MainActivity.java b/app/src/main/java/com/abdurazaaqmohammed/AntiSplit/main/MainActivity.java index b9bc9225..8cbb4a11 100644 --- a/app/src/main/java/com/abdurazaaqmohammed/AntiSplit/main/MainActivity.java +++ b/app/src/main/java/com/abdurazaaqmohammed/AntiSplit/main/MainActivity.java @@ -63,6 +63,8 @@ import com.google.android.material.color.DynamicColors; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.progressindicator.LinearProgressIndicator; +import com.google.android.material.textfield.TextInputEditText; +import com.google.android.material.textfield.TextInputLayout; import com.google.android.material.textview.MaterialTextView; import com.reandroid.apk.ApkBundle; import com.reandroid.apkeditor.merge.LogUtil; @@ -104,6 +106,7 @@ public class MainActivity extends AppCompatActivity implements Merger.LogListene public static int sortMode; public DeviceSpecsUtil DeviceSpecsUtil; private String pkgName; + private static String suffix; private boolean systemTheme; public Handler getHandler() { @@ -113,7 +116,6 @@ public Handler getHandler() { /** @noinspection AssignmentUsedAsCondition*/ @Override protected void onCreate(Bundle savedInstanceState) { - EdgeToEdge.enable(this); super.onCreate(savedInstanceState); DynamicColors.applyToActivitiesIfAvailable(getApplication()); handler = new Handler(Looper.getMainLooper()); @@ -129,6 +131,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); + suffix = settings.getString("suffix", "_antisplit"); lang = settings.getString("lang", "en"); if(Objects.equals(lang, Locale.getDefault().getLanguage())) rss = getResources(); else updateLang(LocaleHelper.setLocale(MainActivity.this, lang).getResources(), null); @@ -137,6 +140,7 @@ protected void onCreate(Bundle savedInstanceState) { getWindow().setNavigationBarColor(transparent); getWindow().setStatusBarColor(transparent); if (!LegacyUtils.supportsWriteExternalStorage) { + EdgeToEdge.enable(this); getWindow().setStatusBarContrastEnforced(true); getWindow().setNavigationBarContrastEnforced(true); } @@ -247,9 +251,28 @@ public void afterTextChanged(Editable s) { ((TextView) settingsDialog.findViewById(R.id.selectSplitsForDeviceToggle)).setText(rss.getString(R.string.automatically_select)); ((TextView) settingsDialog.findViewById(R.id.updateToggle)).setText(rss.getString(R.string.auto_update)); ((TextView) settingsDialog.findViewById(R.id.checkUpdateNow)).setText(rss.getString(R.string.check_update_now)); + ((TextInputLayout) settingsDialog.findViewById(R.id.suffixLayout)).setHint(rss.getString(R.string.suffix)); + TextInputEditText suffixInput = settingsDialog.findViewById(R.id.suffixInput); + suffixInput.setText(suffix); + suffixInput.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + suffix = s.toString(); + } + + @Override + public void afterTextChanged(Editable s) { + + } + }); MaterialButtonToggleGroup themeButtons = settingsDialog.findViewById(R.id.themeToggleGroup); themeButtons.check( - systemTheme ? R.id.systemThemeButton : + systemTheme ? R.id.systemThemeButton : theme == com.google.android.material.R.style.Theme_Material3_Light_NoActionBar ? R.id.lightThemeButton : theme == com.google.android.material.R.style.Theme_Material3_Dark_NoActionBar ? R.id.darkThemeButton : R.id.blackThemeButton @@ -461,6 +484,7 @@ private void updateLang(Resources res, ScrollView settingsDialog) { ((TextView) settingsDialog.findViewById(R.id.selectSplitsForDeviceToggle)).setText(res.getString(R.string.automatically_select)); ((TextView) settingsDialog.findViewById(R.id.updateToggle)).setText(res.getString(R.string.auto_update)); ((TextView) settingsDialog.findViewById(R.id.checkUpdateNow)).setText(res.getString(R.string.check_update_now)); + ((TextInputLayout) settingsDialog.findViewById(R.id.suffixLayout)).setHint(rss.getString(R.string.suffix)); } } @@ -498,6 +522,7 @@ protected void onPause() { .putInt("sortMode", sortMode) .putBoolean("checkForUpdates", checkForUpdates) .putString("lang", lang) + .putString("suffix", suffix) .apply(); super.onPause(); } @@ -524,9 +549,28 @@ public static void deleteDir(File dir) { for (String child : dir.list()) new File(dir, child).delete(); } + /** @noinspection ResultOfMethodCallIgnored*/ + private void cleanupAppFolder() { + if(!doesNotHaveStoragePerm(this)) { + File appFolder = new File(Environment.getExternalStorageDirectory(), "AntiSplit-M"); + if(appFolder.exists()) { + File[] children = appFolder.listFiles(); + if(children != null) { + if (children.length == 0) appFolder.delete(); + else { + for (File child : children) if (child.isFile() && child.length() == 0) child.delete(); + children = appFolder.listFiles(); + if (children.length == 0) appFolder.delete(); + } + } + } + } + } + @Override protected void onDestroy() { deleteDir(getCacheDir()); + cleanupAppFolder(); super.onDestroy(); } @@ -984,6 +1028,7 @@ private void copyText(CharSequence text) { } private void showError(Exception e) { + cleanupAppFolder(); if (!(e instanceof ClosedByInterruptException)) { final String mainErr = e.toString(); errorOccurred = !mainErr.equals(rss.getString(R.string.sign_failed)); @@ -1050,7 +1095,7 @@ public static String getOriginalFileName(Context context, Uri uri) { if (cut != -1) result = result.substring(cut + 1); } LogUtil.logMessage(result); - return result.replaceFirst("\\.(?:xapk|aspk|apk[sm])", "_antisplit.apk"); + return result.replaceFirst("\\.(?:xapk|aspk|apk[sm])", suffix + ".apk"); } catch (Exception ignored) { return "filename_not_found"; } @@ -1061,7 +1106,7 @@ private void selectDirToSaveAPKOrSaveNow() { if (ask) startActivityForResult(new Intent(Intent.ACTION_CREATE_DOCUMENT) .addCategory(Intent.CATEGORY_OPENABLE) .setType("application/vnd.android.package-archive") - .putExtra(Intent.EXTRA_TITLE, TextUtils.isEmpty(pkgName) ? (urisAreSplitApks ? getOriginalFileName(this, splitAPKUri) : getNameFromNonSplitApks()) : pkgName + "_antisplit"), 2); + .putExtra(Intent.EXTRA_TITLE, TextUtils.isEmpty(pkgName) ? (urisAreSplitApks ? getOriginalFileName(this, splitAPKUri) : getNameFromNonSplitApks()) : pkgName + suffix), 2); else { checkStoragePerm(); try { @@ -1076,7 +1121,7 @@ private void selectDirToSaveAPKOrSaveNow() { File f; String newFilePath = TextUtils.isEmpty(originalFilePath) ? getAntisplitMFolder() + File.separator + getOriginalFileName(this, splitAPKUri) // If originalFilePath is null urisAreSplitApks must be true because getNameFromNonSplitApks will always return something - : originalFilePath.replaceFirst("\\.(?:xapk|aspk|apk[sm])", "_antisplit.apk"); + : originalFilePath.replaceFirst("\\.(?:xapk|aspk|apk[sm])", suffix + ".apk"); if(TextUtils.isEmpty(newFilePath) || newFilePath.startsWith("/data/") // || !(f = new File(newFilePath)).createNewFile() || f.canWrite() @@ -1111,6 +1156,6 @@ private String getNameFromNonSplitApks() { break; } } - return (TextUtils.isEmpty(realName) ? "unknown" : realName.replace(".apk", "")) + "_antisplit.apk"; + return (TextUtils.isEmpty(realName) ? "unknown" : realName.replace(".apk", "")) + suffix + ".apk"; } } \ No newline at end of file diff --git a/app/src/main/res/layout/setty.xml b/app/src/main/res/layout/setty.xml index 3e29fe87..1327403b 100644 --- a/app/src/main/res/layout/setty.xml +++ b/app/src/main/res/layout/setty.xml @@ -174,5 +174,29 @@ android:text="@string/lang" style="@style/Widget.Material3.Button.OutlinedButton" /> + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index a4558ed7..3344e3d6 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1,5 +1,4 @@ - AntiSplit M اختر ملف APK المقسم للدمج/أنتي سبلت تم حفظ الملف بنجاح تفعيل السجلات @@ -33,7 +32,6 @@ الدليل الرئيسي آخر تعديل: لا يمكن الوصول إلى الدليل - Language تحديث متاح إصدار جديد من AntiSplit M متاح تحميل @@ -45,29 +43,6 @@ المقاطع التالية (%1$s) تحتوي على رموز إصدار غير متطابقة. هي فقط رموز لغات، لذا يمكن للتطبيق العمل بدونها، لكن هذه اللغات لن تعمل في التطبيق. هل ترغب في الاستمرار في الدمج على أي حال؟ تحذير " رمز الإصدار لا يتطابق مع base.apk" - - الإنجليزية - الإسبانية - الفرنسية - البهاسا الإندونيسية - الإيطالية - الروسية - التركية - الأوكرانية - البرتغالية - - - en - es - fr - in - it - ru - tr - uk - pt-BR - - إنشاء مشكلة على GitHub نسخ السجل زر الإيقاف المؤقت @@ -75,4 +50,5 @@ اختر من التطبيقات المثبتة أيقونة التطبيق تثبيت - + اللاحقة + \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index aacff008..055a6e79 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -50,4 +50,5 @@ Botón de pausa Registro copiado Seleccionar desde aplicaciones instaladas + Sufijo diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 6f8431c7..1884b27b 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -44,4 +44,7 @@ Les splits suivants (%1$s) ont des codes de version incompatibles. Ce sont uniquement des codes de langue, donc l\'application peut fonctionner sans eux, mais ces langues ne seront pas disponibles dans l\'application. Voulez-vous continuer la fusion malgré tout ? Avertissement " le code de version ne correspond pas à celui de base.apk" + Icône de l\'application + Installer + Suffixe diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index 57f40acd..9ade7802 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -33,4 +33,5 @@ Terakhir kali disunting: Direktorinya tidak bisa diakses Bahasa + Akhiran diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 860c3d43..3e27d327 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -51,4 +51,5 @@ Scegli dalle App Installate Icona app Installa + Suffisso \ No newline at end of file diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 32f32594..a71c8242 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -1,5 +1,4 @@ - AntiSplit M Selecione split APK para mesclar/AntiSplit Arquivo salvo com sucesso Ativar logs @@ -50,4 +49,5 @@ Copiar log Botão de pausa Log copiado + Sufixo \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 0d2e09f2..736cb825 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -34,4 +34,5 @@ "Пропуск " Файл успешно сохранен : Не выбрано + Суффикс diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index e271dc15..cbe7d998 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -32,4 +32,5 @@ Ana Klasör Son düzenlenme: Klasöre erişilemedi + Sonek diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 3ee98b6b..1e1f0a9d 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -34,4 +34,5 @@ "Перепустка " Файл успішно збережено : Не вибрано + Суфікс diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6d6dd4fe..849d3c90 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -79,4 +79,5 @@ Dark theme Light theme System theme + Suffix