Skip to content

Commit

Permalink
1.6.3.3
Browse files Browse the repository at this point in the history
Add Turkish translation by @rywz
Add options to dialog to select splits for current device architecture, language and screen size individually
  • Loading branch information
AbdurazaaqMohammed committed Aug 6, 2024
1 parent 78d5017 commit ef98af7
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 37 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId = "com.abdurazaaqmohammed.AntiSplit"
minSdk = 4
targetSdk = 35
versionCode = 16
versionName = "1.6.3.1"
versionCode = 18
versionName = "1.6.3.3"
multiDexEnabled = true
}

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="29"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" android:minSdkVersion="30"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.DisplayMetrics;

Expand All @@ -13,6 +14,7 @@
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Locale;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
Expand Down Expand Up @@ -50,7 +52,25 @@ public static List<String> getListOfSplits(Uri splitAPKUri, Context context) thr
return splits;
}

public static boolean shouldIncludeSplit(String name, Context context) {
return name.equals("base.apk")
|| !name.startsWith("config") && !name.startsWith("split") // this is base.apk hopefully
|| shouldIncludeLang(name) || shouldIncludeArch(name) || shouldIncludeDpi(name, context);
}

public static boolean shouldIncludeLang(String name) {
return name.contains(Locale.getDefault().getLanguage());
}

public static boolean shouldIncludeArch(String name) {
String arch = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) ? Build.SUPPORTED_ABIS[0] : Build.CPU_ABI;
return name.contains(arch) || name.replace('-', '_').contains(arch.replace('-', '_'));
}

public static boolean shouldIncludeDpi(String name, Context context) {
String densityType = getDeviceDpi(context);
return (name.endsWith(densityType) && !name.replace(densityType, "").endsWith("x")); // ensure that it does not select xxhdpi for xhdpi etc
}

public static String getDeviceDpi(Context context) {
String densityType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.abdurazaaqmohammed.AntiSplit.main;

import static android.provider.Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION;
import static com.abdurazaaqmohammed.AntiSplit.main.DeviceSpecsUtil.getDeviceDpi;
import static com.reandroid.apkeditor.merge.LogUtil.logEnabled;

import com.github.angads25.filepicker.model.DialogConfigs;
Expand Down Expand Up @@ -47,7 +46,6 @@
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Objects;

import yuku.ambilwarna.AmbilWarnaDialog;
Expand Down Expand Up @@ -318,16 +316,6 @@ protected void onDestroy() {
super.onDestroy();
}

public boolean shouldIncludeSplit(String name) {
if (name.equals("base.apk")
|| !name.startsWith("config") && !name.startsWith("split") // this is base.apk hopefully
|| name.contains(Locale.getDefault().getLanguage()) // this should probably not be cached
) return true;
String arch = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) ? Build.SUPPORTED_ABIS[0] : Build.CPU_ABI;
if(name.contains(arch) || name.replace('-', '_').contains(arch.replace('-', '_'))) return true;
String densityType = getDeviceDpi(this);
return (name.endsWith(densityType) && !name.replace(densityType, "").endsWith("x")); // ensure that it does not select xxhdpi for xhdpi etc
}

private List<String> splitsToUse = null;

Expand Down Expand Up @@ -358,7 +346,7 @@ protected Void doInBackground(Uri... uris) {
if(!splitApkContainsArch && (thisSplit.contains("armeabi") || thisSplit.contains("arm64") || thisSplit.contains("x86") || thisSplit.contains("mips"))) {
splitApkContainsArch = true;
}
if (activity.shouldIncludeSplit(thisSplit)) splits.remove(thisSplit);
if (DeviceSpecsUtil.shouldIncludeSplit(thisSplit, activity)) splits.remove(thisSplit);
}
if(splitApkContainsArch) {
boolean selectedSplitsContainsArch = false;
Expand Down Expand Up @@ -488,13 +476,16 @@ public void showApkSelectionDialog() {
try {
List<String> splits = DeviceSpecsUtil.getListOfSplits(splitAPKUri, this);
final int initialSize = splits.size();
String[] apkNames = new String[initialSize + 2];
boolean[] checkedItems = new boolean[initialSize + 2];
String[] apkNames = new String[initialSize + 5];
boolean[] checkedItems = new boolean[initialSize + 5];

apkNames[0] = getString(R.string.all);
apkNames[1] = getString(R.string.for_device);
for (int i = 2; i < initialSize + 2; i++) {
apkNames[i] = splits.get(i - 2);
apkNames[2] = getString(R.string.arch_for_device);
apkNames[3] = getString(R.string.dpi_for_device);
apkNames[4] = getString(R.string.lang_for_device);
for (int i = 5; i < initialSize + 5; i++) {
apkNames[i] = splits.get(i - 5);
checkedItems[i] = false;
}

Expand All @@ -510,33 +501,70 @@ public void showApkSelectionDialog() {
switch (which) {
case 0:
// "Select All" option
for (int i = 2; i < checkedItems.length; i++) ((AlertDialog) dialog).getListView().setItemChecked(i, checkedItems[i] = isChecked);
for (int i = 5; i < checkedItems.length; i++) ((AlertDialog) dialog).getListView().setItemChecked(i, checkedItems[i] = isChecked);
break;
case 1:
// device specs option
for (int i = 2; i < checkedItems.length; i++) {
((AlertDialog) dialog).getListView().setItemChecked(i, checkedItems[i] = (isChecked && shouldIncludeSplit(apkNames[i])));
for (int i = 5; i < checkedItems.length; i++) {
((AlertDialog) dialog).getListView().setItemChecked(i, checkedItems[i] = (isChecked && DeviceSpecsUtil.shouldIncludeSplit(apkNames[i], this)));
}
boolean didNotFindAppropriateDpi = true;
for (int i = 2; i < checkedItems.length; i++) {
for (int i = 5; i < checkedItems.length; i++) {
if (checkedItems[i] && apkNames[i].contains("dpi")) {
didNotFindAppropriateDpi = false;
break;
}
}
if (didNotFindAppropriateDpi) {
for (int i = 2; i < checkedItems.length; i++) {
for (int i = 5; i < checkedItems.length; i++) {
if (apkNames[i].contains("hdpi")) {
((AlertDialog) dialog).getListView().setItemChecked(i, checkedItems[i] = isChecked);
break;
}
}
}
break;
case 2:
//arch for device
for (int i = 5; i < checkedItems.length; i++) {
if(DeviceSpecsUtil.shouldIncludeArch(apkNames[i])) ((AlertDialog) dialog).getListView().setItemChecked(i, checkedItems[i] = isChecked);
}
break;
case 3:
//dpi for device
for (int i = 5; i < checkedItems.length; i++) {
if(DeviceSpecsUtil.shouldIncludeDpi(apkNames[i], this)) ((AlertDialog) dialog).getListView().setItemChecked(i, checkedItems[i] = isChecked);
}
boolean didNotFoundAppropriateDpi = true;
for (int i = 5; i < checkedItems.length; i++) {
if (checkedItems[i] && apkNames[i].contains("dpi")) {
didNotFoundAppropriateDpi = false;
break;
}
}
if (didNotFoundAppropriateDpi) {
for (int i = 5; i < checkedItems.length; i++) {
if (apkNames[i].contains("hdpi")) {
((AlertDialog) dialog).getListView().setItemChecked(i, checkedItems[i] = isChecked);
break;
}
}
}
break;
case 4:
//lang for device
for (int i = 5; i < checkedItems.length; i++) {
if(DeviceSpecsUtil.shouldIncludeLang(apkNames[i])) ((AlertDialog) dialog).getListView().setItemChecked(i, checkedItems[i] = isChecked);
}
break;
default:
ListView listView = ((AlertDialog) dialog).getListView();
if (!isChecked) listView.setItemChecked(0, checkedItems[0] = false); // Uncheck "Select All" if any individual item is unchecked
if (checkedItems[1] && !shouldIncludeSplit(apkNames[which])) listView.setItemChecked(1, checkedItems[1] = false); // uncheck device arch if non device arch selected
for (int i = 1; i <= 4; i++) {
if (checkedItems[i] && !DeviceSpecsUtil.shouldIncludeSplit(apkNames[which], this)) {
listView.setItemChecked(i, checkedItems[i] = false); // uncheck device arch if non device arch selected
}
}
break;
}
});
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
<string name="download_fix">Скачать исправленный ReVanced Manager</string>
<string name="enable_logs">Включить журналы</string>
<string name="error_dir_access">Доступ к каталогу невозможен</string>
<string name="for_device">Выбор в соответствии вашей архитектуры устройства</string>
<string name="for_device">Выбор все в соответствии вашей архитектуры устройства</string>
<string name="lang_for_device">Выбор язык для вашего устройства</string>
<string name="arch_for_device">Выбор архитектуру для вашего устройства</string>
<string name="dpi_for_device">Выбор ширину экрана для вашего устройства</string>
<string name="grant_storage">Необходимо разрешение на хранение для сохранения в той же папке, что и выбранный файл</string>
<string name="label_parent_dir">…</string>
<string name="label_parent_directory">Родительский каталог</string>
Expand Down
17 changes: 9 additions & 8 deletions app/src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<resources>
<string name="app_name">AntiSplit M</string>
<string name="oldAndroidInfo">Not: Android sürümünüz dosya seçiciyi kullanmak için çok eski. Dosyanın konumunu manuel olarak girmeniz gerekiyor. Dosyalar dahili depolama alanındaki "İndirilenler" klasörüne kaydedilecektir.</string>
<string name="merge">Birleştirmek/Ayrıştırmak için split APK'yı seçin.</string>
<string name="merge">Birleştirmek/Ayrıştırmak için split APK\'yı seçin.</string>
<string name="success_saved">Dosya başarıyla kaydedildi.</string>
<string name="enable_logs">Kayıtları etkinleştir</string>
<string name="ask">Her seferinde dosyanın nereye kaydedileceğini sor (devre dışı bırakılırsa, birleştirilmiş APK, split APK'nın bulunduğu klasöre kaydedilir)</string>
<string name="ask">Her seferinde dosyanın nereye kaydedileceğini sor (devre dışı bırakılırsa, birleştirilmiş APK, split APK\'nın bulunduğu klasöre kaydedilir)</string>
<string name="grant_storage">Storage permission needed to save to the same dir as the selected file</string>
<string name="no_filepath">Seçilen dosyanın dosya yolu bulunamadı</string>
<string name="output">"Çıktı klasörü: "</string>
Expand All @@ -13,9 +12,12 @@
<string name="change_text_color">Yazı rengini değiştir</string>
<string name="change_background_color">Arkaplan rengini değiştir </string>
<string name="all">Hepsini seç</string>
<string name="for_device">Cihazın özelliklerine göre seç</string>
<string name="for_device">Cihazın özelliklerine göre hepsini seç</string>
<string name="lang_for_device">Cihazınız için dili seç</string>
<string name="arch_for_device">Cihazınız için mimariyi seç</string>
<string name="dpi_for_device">Cihazınız için ekran genişliklerini seç</string>
<string name="select_splits">Splitleri seç</string>
<string name="sign_apk">APK'yı birleştirdikten sonra imzala</string>
<string name="sign_apk">APK\'yı birleştirdikten sonra imzala</string>
<string name="automatically_select">Cihazınızın özelliklerine uygun splitleri otomatik olarak seçin</string>
<string name="sign_failed">APK imzalanamadığından böylece kaydediliyor.</string>
<string name="signing">APK imzalanıyor…</string>
Expand All @@ -27,12 +29,11 @@
<string name="unselected">Seçilmedi </string>
<string name="detected_xapk">XAPK dosyası tespit edildi, düzgün bir şekilde çıkarılabilmesi sağlanacak</string>
<string name="searching">APK dosyası aranıyor…</string>
<string name="revanced">ReVanced Manager, split APK'ları patchlemeye çalışırken bir hata ortaya çıkıyor. Bu hata gerçek bir sorun değil ve üçüncü taraf bir kütüphaneden dolayı kaynaklanıyor. Çoğu kişi için, cihaz özellikleriniz için seçme seçeneğini kullanmak sorunu çözecektir. Yine de çalışmazsa yapılacak en kolay şey ReVanced Manager'ın hatanın kaldırıldığı sürümü indirmektir.</string>
<string name="revanced">ReVanced Manager, split APK\'ları patchlemeye çalışırken bir hata ortaya çıkıyor. Bu hata gerçek bir sorun değil ve üçüncü taraf bir kütüphaneden dolayı kaynaklanıyor. Çoğu kişi için, cihaz özellikleriniz için seçme seçeneğini kullanmak sorunu çözecektir. Yine de çalışmazsa yapılacak en kolay şey ReVanced Manager\'ın hatanın kaldırıldığı sürümü indirmektir.</string>
<string name="note">ReVanced için not</string>
<string name="download_fix">Hatanın düzeltildiği ReVanced Manager'ı indir</string>
<string name="download_fix">Hatanın düzeltildiği ReVanced Manager\'ı indir</string>
<string name="cancel_button_label">İptal et</string>
<string name="choose_button_label">Seç</string>
<string name="default_dir" translatable="false">/sdcard</string>
<string name="label_parent_directory">Ana Klasör</string>
<string name="last_edit">Son düzenlenme: </string>
<string name="error_dir_access">Klasöre erişilemedi</string>
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<string name="app_name">AntiSplit M</string>
<string name="merge">Select split APK to Merge/AntiSplit</string>
<string name="success_saved">File saved successfully</string>
<string name="enable_logs">Enable logs</string>
<string name="enable_logs" >Enable logs</string>
<string name="ask">Ask where to save the file each time (if disabled, save the merged APK to the same directory where the split file was from)</string>
<string name="grant_storage">Storage permission needed to save to the same dir as the selected file</string>
<string name="no_filepath">Couldn\'t find filepath of the selected file</string>
Expand All @@ -12,7 +12,10 @@
<string name="change_text_color">Change text color</string>
<string name="change_background_color">Change background color</string>
<string name="all">Select All</string>
<string name="for_device">Select for your device specifications</string>
<string name="for_device">Select all splits for your device specifications</string>
<string name="lang_for_device">Select language for your device</string>
<string name="arch_for_device">Select architecture for your device</string>
<string name="dpi_for_device">Select screen widths for your device</string>
<string name="select_splits">Select splits</string>
<string name="sign_apk">Sign the APK after merging</string>
<string name="automatically_select">Automatically select splits for your device specifications</string>
Expand Down

0 comments on commit ef98af7

Please sign in to comment.