diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1224d885..a441b8cc 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -10,8 +10,8 @@ android { applicationId = "com.abdurazaaqmohammed.AntiSplit" minSdk = 4 targetSdk = 35 - versionCode = 18 - versionName = "1.6.3.3" + versionCode = 19 + versionName = "1.6.3.4" multiDexEnabled = true } diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 00000000..0c4dae40 Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ diff --git a/app/src/main/java/ankur035/LocaleHelper.java b/app/src/main/java/ankur035/LocaleHelper.java new file mode 100644 index 00000000..89335c01 --- /dev/null +++ b/app/src/main/java/ankur035/LocaleHelper.java @@ -0,0 +1,65 @@ +package ankur035; +import android.annotation.TargetApi; +import android.content.Context; +import android.content.SharedPreferences; +import android.content.res.Configuration; +import android.content.res.Resources; +import android.os.Build; +import android.preference.PreferenceManager; + +import java.util.Locale; + +public class LocaleHelper { + private static final String SELECTED_LANGUAGE = "Locale.Helper.Selected.Language"; + + // Method to set the language at runtime + public static Context setLocale(Context context, String language) { + persist(context, language); + + // Updating the language for devices above Android Nougat + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + return updateResources(context, language); + } + // For devices with lower versions of Android OS + return updateResourcesLegacy(context, language); + } + + private static void persist(Context context, String language) { + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); + SharedPreferences.Editor editor = preferences.edit(); + editor.putString(SELECTED_LANGUAGE, language); + if(Build.VERSION.SDK_INT > 8) editor.apply(); + else editor.commit(); + } + + // Method to update the language of the application by creating + // an object of the inbuilt Locale class and passing the language argument to it + @TargetApi(Build.VERSION_CODES.N) + private static Context updateResources(Context context, String language) { + Locale locale = new Locale(language); + Locale.setDefault(locale); + + Configuration configuration = context.getResources().getConfiguration(); + configuration.setLocale(locale); + configuration.setLayoutDirection(locale); + + return context.createConfigurationContext(configuration); + } + + private static Context updateResourcesLegacy(Context context, String language) { + Locale locale = new Locale(language); + Locale.setDefault(locale); + + Resources resources = context.getResources(); + Configuration configuration = resources.getConfiguration(); + configuration.locale = locale; + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { + configuration.setLayoutDirection(locale); + } + + resources.updateConfiguration(configuration, resources.getDisplayMetrics()); + + return context; + } +} 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 64a9933c..ef94b95f 100644 --- a/app/src/main/java/com/abdurazaaqmohammed/AntiSplit/main/MainActivity.java +++ b/app/src/main/java/com/abdurazaaqmohammed/AntiSplit/main/MainActivity.java @@ -16,8 +16,14 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.content.res.Resources; import android.database.Cursor; import android.graphics.LightingColorFilter; +import android.graphics.Paint; +import android.graphics.drawable.GradientDrawable; +import android.graphics.drawable.LayerDrawable; +import android.graphics.drawable.ShapeDrawable; +import android.graphics.drawable.shapes.RectShape; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; @@ -28,6 +34,8 @@ import android.provider.OpenableColumns; import android.text.TextUtils; import android.view.View; +import android.view.Window; +import android.widget.Button; import android.widget.CompoundButton; import android.widget.ListView; import android.widget.ScrollView; @@ -46,8 +54,10 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.Objects; +import ankur035.LocaleHelper; import yuku.ambilwarna.AmbilWarnaDialog; /** @noinspection deprecation*/ @@ -62,6 +72,17 @@ public class MainActivity extends Activity implements Merger.LogListener { public static int textColor; public static int bgColor; public static boolean errorOccurred; + public static String lang; + + private void setButtonBorder(Button button) { + ShapeDrawable border = new ShapeDrawable(new RectShape()); + Paint paint = border.getPaint(); + paint.setStyle(Paint.Style.STROKE); + paint.setColor(textColor); + paint.setStrokeWidth(4); + + button.setBackgroundDrawable(border); + } private void setColor(int color, boolean isTextColor) { if(isTextColor) { @@ -74,9 +95,38 @@ private void setColor(int color, boolean isTextColor) { ((TextView) findViewById(supportsSwitch ? R.id.showDialogToggle : R.id.showDialogToggleText)).setTextColor(color); ((TextView) findViewById(supportsSwitch ? R.id.signToggle : R.id.signToggleText)).setTextColor(color); ((TextView) findViewById(supportsSwitch ? R.id.selectSplitsForDeviceToggle : R.id.selectSplitsForDeviceToggleText)).setTextColor(color); + Button langPicker = findViewById(R.id.langPicker); + langPicker.setTextColor(color); + setButtonBorder(langPicker); + Button revanced = findViewById(R.id.revanced); + revanced.setTextColor(color); + setButtonBorder(revanced); + Button decodeButton = findViewById(R.id.decodeButton); + decodeButton.setTextColor(color); + setButtonBorder(decodeButton); + Button changeTextColor = findViewById(R.id.changeTextColor); + changeTextColor.setTextColor(color); + setButtonBorder(changeTextColor); + Button changeBgColor = findViewById(R.id.changeBgColor); + changeBgColor.setTextColor(color); + setButtonBorder(changeBgColor); } else { bgColor = color; - findViewById(R.id.main).setBackgroundColor(color); + Button langPicker = findViewById(R.id.langPicker); + langPicker.setBackgroundColor(color); + setButtonBorder(langPicker); + Button revanced = findViewById(R.id.revanced); + revanced.setBackgroundColor(color); + setButtonBorder(revanced); + Button decodeButton = findViewById(R.id.decodeButton); + decodeButton.setBackgroundColor(color); + setButtonBorder(decodeButton); + Button changeTextColor = findViewById(R.id.changeTextColor); + changeTextColor.setBackgroundColor(color); + setButtonBorder(changeTextColor); + Button changeBgColor = findViewById(R.id.changeBgColor); + changeBgColor.setBackgroundColor(color); + setButtonBorder(changeBgColor); } } @@ -108,6 +158,9 @@ protected void onCreate(Bundle savedInstanceState) { logEnabled = settings.getBoolean("logEnabled", true); LogUtil.setLogListener(this); + lang = settings.getString("lang", "en"); + if(lang.equals(Locale.getDefault().getLanguage())) rss = getResources(); + else updateLang(LocaleHelper.setLocale(MainActivity.this, lang).getResources()); CompoundButton logSwitch = findViewById(R.id.logToggle); logSwitch.setChecked(logEnabled); @@ -155,6 +208,27 @@ protected void onCreate(Bundle savedInstanceState) { }); } + findViewById(R.id.langPicker).setOnClickListener(v -> { + int curr = -1; + + /* + for(int i=0; i { + updateLang(LocaleHelper.setLocale(MainActivity.this, lang = rss.getStringArray(R.array.langs)[which]).getResources()); + dialog.dismiss(); + }).create(), display); + }); + findViewById(R.id.decodeButton).setOnClickListener(v -> { if(LegacyUtils.doesNotSupportInbuiltAndroidFilePicker) { DialogProperties properties = new DialogProperties(); @@ -165,7 +239,7 @@ protected void onCreate(Bundle savedInstanceState) { properties.offset = new File(DialogConfigs.DEFAULT_DIR); properties.extensions = new String[] {"apk", "zip", "apks", "aspk", "apks", "xapk", "apkm"}; FilePickerDialog dialog = new FilePickerDialog(MainActivity.this, properties, textColor, bgColor); - dialog.setTitle(R.string.choose_button_label); + dialog.setTitle(rss.getString(R.string.choose_button_label)); dialog.setDialogSelectionListener(files -> { urisAreSplitApks = !files[0].endsWith(".apk"); uris = new ArrayList<>(); @@ -190,27 +264,21 @@ protected void onCreate(Bundle savedInstanceState) { findViewById(R.id.changeBgColor).setOnClickListener(v -> showColorPickerDialog(false, bgColor)); findViewById(R.id.changeTextColor).setOnClickListener(v -> showColorPickerDialog(true, textColor)); findViewById(R.id.revanced).setOnClickListener(v -> { - AlertDialog.Builder builder = new AlertDialog.Builder(this); TextView title = new TextView(this); - title.setText(R.string.note); + title.setText(rss.getString(R.string.note)); title.setTextSize(20); title.setTextColor(textColor); - builder.setCustomTitle(title); - + title.setPadding(15,15,15,15); TextView message = new TextView(this); - message.setText(R.string.revanced); + message.setText(rss.getString(R.string.revanced)); message.setTextSize(15); message.setTextColor(textColor); - builder.setView(message); - - builder.setPositiveButton(R.string.download_fix, (dialog, which) -> startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://github.com/AbdurazaaqMohammed/revanced-antisplit")))) - .setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss()); - - final AlertDialog ad = builder.create(); - ad.show(); - try { - Objects.requireNonNull(ad.getWindow()).getDecorView().getBackground().setColorFilter(new LightingColorFilter(0xFF000000, bgColor)); - } catch (NullPointerException ignored) {} + message.setPadding(15,15,15,15); + styleAlertDialog(new AlertDialog.Builder(this) + .setCustomTitle(title) + .setView(message) + .setPositiveButton(rss.getString(R.string.download_fix), (dialog, which) -> startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://github.com/AbdurazaaqMohammed/revanced-antisplit")))) + .setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss()).create(), null); }); // Check if user shared or opened file with the app. @@ -236,6 +304,42 @@ protected void onCreate(Bundle savedInstanceState) { } } + public void styleAlertDialog(AlertDialog ad, String[] display) { + GradientDrawable border = new GradientDrawable(); + border.setColor(bgColor); // Background color + border.setStroke(5, textColor); // Border width and color + border.setCornerRadius(16); + + LayerDrawable layerDrawable = new LayerDrawable(new GradientDrawable[]{border}); + + runOnUiThread(() -> { + ad.show(); + if(display != null) ad.getListView().setAdapter(new CustomArrayAdapter(this, display, textColor)); + Window w = ad.getWindow(); + if (w != null) { + w.getDecorView().getBackground().setColorFilter(new LightingColorFilter(0xFF000000, bgColor)); + w.setBackgroundDrawable(layerDrawable); + } + }); + } + + public static Resources rss; + + private void updateLang(Resources res) { + rss = res; + ((TextView) findViewById(R.id.langPicker)).setText(res.getString(R.string.lang)); + final boolean supportsSwitch = Build.VERSION.SDK_INT > 13; + ((TextView) findViewById(supportsSwitch ? R.id.logToggle : R.id.logToggleText)).setText(res.getString(R.string.enable_logs)); + ((TextView) findViewById(supportsSwitch ? R.id.ask : R.id.askText)).setText(res.getString(R.string.ask)); + ((TextView) findViewById(supportsSwitch ? R.id.showDialogToggle : R.id.showDialogToggleText)).setText(res.getString(R.string.show_dialog)); + ((TextView) findViewById(supportsSwitch ? R.id.signToggle : R.id.signToggleText)).setText(res.getString(R.string.sign_apk)); + ((TextView) findViewById(supportsSwitch ? R.id.selectSplitsForDeviceToggle : R.id.selectSplitsForDeviceToggleText)).setText(res.getString(R.string.automatically_select)); + ((TextView) findViewById(R.id.decodeButton)).setText(res.getString(R.string.merge)); + ((TextView) findViewById(R.id.changeTextColor)).setText(res.getString(R.string.change_text_color)); + ((TextView) findViewById(R.id.changeBgColor)).setText(res.getString(R.string.change_background_color)); + ((TextView) findViewById(R.id.revanced)).setText(res.getString(R.string.note)); + } + private void showColorPickerDialog(boolean isTextColor, int currentColor) { new AmbilWarnaDialog(this, currentColor, new AmbilWarnaDialog.OnAmbilWarnaListener() { @Override @@ -258,7 +362,7 @@ final File getAntisplitMFolder() { @TargetApi(Build.VERSION_CODES.M) private void checkStoragePerm() { if(doesNotHaveStoragePerm(this)) { - Toast.makeText(this, R.string.grant_storage, Toast.LENGTH_LONG).show(); + Toast.makeText(this, rss.getString(R.string.grant_storage), Toast.LENGTH_LONG).show(); if(LegacyUtils.supportsWriteExternalStorage) requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0); else startActivityForResult(new Intent(ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, Uri.parse("package:" + getPackageName())), 0); } @@ -280,7 +384,8 @@ protected void onPause() { .putBoolean("signApk", signApk) .putBoolean("selectSplitsForDevice", selectSplitsForDevice) .putInt("textColor", textColor) - .putInt("backgroundColor", bgColor); + .putInt("backgroundColor", bgColor) + .putString("lang", lang); if (LegacyUtils.supportsArraysCopyOf) e.apply(); else e.commit(); super.onPause(); @@ -479,25 +584,23 @@ public void showApkSelectionDialog() { 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); - apkNames[2] = getString(R.string.arch_for_device); - apkNames[3] = getString(R.string.dpi_for_device); - apkNames[4] = getString(R.string.lang_for_device); + apkNames[0] = rss.getString(R.string.all); + apkNames[1] = rss.getString(R.string.for_device); + apkNames[2] = rss.getString(R.string.arch_for_device); + apkNames[3] = rss.getString(R.string.dpi_for_device); + apkNames[4] = rss.getString(R.string.lang_for_device); for (int i = 5; i < initialSize + 5; i++) { apkNames[i] = splits.get(i - 5); checkedItems[i] = false; } - AlertDialog.Builder builder = new AlertDialog.Builder(this); - TextView title = new TextView(this); title.setTextColor(textColor); title.setTextSize(20); - title.setText(R.string.select_splits); - builder.setCustomTitle(title); + title.setText(rss.getString(R.string.select_splits)); + title.setPadding(15,15,15,15); - builder.setMultiChoiceItems(apkNames, checkedItems, (dialog, which, isChecked) -> { + styleAlertDialog(new AlertDialog.Builder(this).setCustomTitle(title).setMultiChoiceItems(apkNames, checkedItems, (dialog, which, isChecked) -> { switch (which) { case 0: // "Select All" option @@ -567,29 +670,19 @@ public void showApkSelectionDialog() { } break; } - }); - builder.setPositiveButton("OK", (dialog, which) -> { + }).setPositiveButton("OK", (dialog, which) -> { for (int i = 1; i < checkedItems.length; i++) { if (checkedItems[i]) splits.remove(apkNames[i]); // ????? } if (splits.size() == initialSize) { urisAreSplitApks = true; // reset - showError(getString(R.string.nothing)); + showError(rss.getString(R.string.nothing)); } else { splitsToUse = splits; selectDirToSaveAPKOrSaveNow(); } - }); - builder.setNegativeButton("Cancel", null); - runOnUiThread(() -> { - final AlertDialog ad = builder.create(); - ad.show(); - ad.getListView().setAdapter(new CustomArrayAdapter(this, apkNames, textColor)); - try { - Objects.requireNonNull(ad.getWindow()).getDecorView().getBackground().setColorFilter(new LightingColorFilter(0xFF000000, bgColor)); - } catch (NullPointerException ignored) {} - }); + }).setNegativeButton("Cancel", null).create(), apkNames); } catch (IOException e) { showError(e); } @@ -597,8 +690,9 @@ public void showApkSelectionDialog() { private void showSuccess() { if(!errorOccurred) { - LogUtil.logMessage(R.string.success_saved); - runOnUiThread(() -> Toast.makeText(this, R.string.success_saved, Toast.LENGTH_SHORT).show()); + final String success = rss.getString(R.string.success_saved); + LogUtil.logMessage(success); + runOnUiThread(() -> Toast.makeText(this, success, Toast.LENGTH_SHORT).show()); } } @@ -668,9 +762,9 @@ private void selectDirToSaveAPKOrSaveNow() { : originalFilePath.replaceFirst("\\.(?:xapk|aspk|apk[sm])", "_antisplit.apk"); if(TextUtils.isEmpty(newFilePath) || newFilePath.startsWith("/data/") || !(f = new File(newFilePath)).canWrite()) { // when a file is shared it in /data/ f = new File(getAntisplitMFolder(), newFilePath.substring(newFilePath.lastIndexOf(File.separator) + 1)); - showError(getString(R.string.no_filepath)); + showError(rss.getString(R.string.no_filepath)); } - LogUtil.logMessage(getString(R.string.output) + f); + LogUtil.logMessage(rss.getString(R.string.output) + f); new ProcessTask(this).execute(Uri.fromFile(f)); } catch (IOException e) { diff --git a/app/src/main/java/com/github/angads25/filepicker/controller/adapters/FileListAdapter.java b/app/src/main/java/com/github/angads25/filepicker/controller/adapters/FileListAdapter.java index 88ba35ca..dc71896d 100644 --- a/app/src/main/java/com/github/angads25/filepicker/controller/adapters/FileListAdapter.java +++ b/app/src/main/java/com/github/angads25/filepicker/controller/adapters/FileListAdapter.java @@ -132,14 +132,14 @@ else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) SimpleDateFormat sdate = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault()); SimpleDateFormat stime = new SimpleDateFormat("hh:mm aa", Locale.getDefault()); Date date = new Date(item.getTime()); - if(i==0&&item.getFilename().startsWith(context.getString(R.string.label_parent_dir))) { - holder.type.setText(R.string.label_parent_directory); + if(i==0&&item.getFilename().startsWith(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.label_parent_dir))) { + holder.type.setText(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.label_parent_directory)); } else { - holder.type.setText(context.getString(R.string.last_edit) + sdate.format(date) + ", " + stime.format(date)); + holder.type.setText(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.last_edit) + sdate.format(date) + ", " + stime.format(date)); } if(holder.fmark.getVisibility()==View.VISIBLE) { - if(i==0&&item.getFilename().startsWith(context.getString(R.string.label_parent_dir))) + if(i==0&&item.getFilename().startsWith(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.label_parent_dir))) { holder.fmark.setVisibility(View.INVISIBLE); } holder.fmark.setChecked(MarkedItemList.hasItem(item.getLocation())); diff --git a/app/src/main/java/com/github/angads25/filepicker/view/FilePickerDialog.java b/app/src/main/java/com/github/angads25/filepicker/view/FilePickerDialog.java index 2d9f5e05..178053b1 100644 --- a/app/src/main/java/com/github/angads25/filepicker/view/FilePickerDialog.java +++ b/app/src/main/java/com/github/angads25/filepicker/view/FilePickerDialog.java @@ -149,7 +149,7 @@ protected void onCreate(Bundle savedInstanceState) { * selected. */ positiveBtnNameStr = positiveBtnNameStr == null ? - context.getResources().getString(R.string.choose_button_label) : positiveBtnNameStr; + com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.choose_button_label) : positiveBtnNameStr; int size1 = MarkedItemList.getFileCount(); if (size1 == 0) { select.setEnabled(false); @@ -215,7 +215,7 @@ protected void onStart() { super.onStart(); positiveBtnNameStr = ( positiveBtnNameStr == null ? - context.getResources().getString(R.string.choose_button_label) : + com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.choose_button_label) : positiveBtnNameStr ); select.setText(positiveBtnNameStr); @@ -225,7 +225,7 @@ protected void onStart() { if (properties.offset.isDirectory() && validateOffsetPath()) { currLoc = new File(properties.offset.getAbsolutePath()); FileListItem parent = new FileListItem(); - parent.setFilename(context.getString(R.string.label_parent_dir)); + parent.setFilename(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.label_parent_dir)); parent.setDirectory(true); parent.setLocation(currLoc.getParentFile().getAbsolutePath()); parent.setTime(currLoc.lastModified()); @@ -263,7 +263,7 @@ public void onItemClick(AdapterView adapterView, View view, int i, long l) { internalList.clear(); if (!currLoc.getName().equals(properties.root.getName())) { FileListItem parent = new FileListItem(); - parent.setFilename(context.getString(R.string.label_parent_dir)); + parent.setFilename(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.label_parent_dir)); parent.setDirectory(true); parent.setLocation(currLoc.getParentFile().getAbsolutePath()); parent.setTime(currLoc.lastModified()); @@ -272,7 +272,7 @@ public void onItemClick(AdapterView adapterView, View view, int i, long l) { internalList = Utility.prepareFileListEntries(internalList, currLoc, filter); mFileListAdapter.notifyDataSetChanged(); } else { - Toast.makeText(context, R.string.error_dir_access, Toast.LENGTH_SHORT).show(); + Toast.makeText(context, com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.error_dir_access), Toast.LENGTH_SHORT).show(); } } else { MaterialCheckbox fmark = view.findViewById(R.id.file_mark); @@ -417,7 +417,7 @@ public void show() { } else { super.show(); positiveBtnNameStr = positiveBtnNameStr == null ? - context.getResources().getString(R.string.choose_button_label) : positiveBtnNameStr; + com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.choose_button_label) : positiveBtnNameStr; select.setText(positiveBtnNameStr); int size = MarkedItemList.getFileCount(); if (size == 0) { @@ -448,7 +448,7 @@ public void onBackPressed() { internalList.clear(); if (!currLoc.getName().equals(properties.root.getName())) { FileListItem parent = new FileListItem(); - parent.setFilename(context.getString(R.string.label_parent_dir)); + parent.setFilename(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.label_parent_dir)); parent.setDirectory(true); parent.setLocation(currLoc.getParentFile().getAbsolutePath()); parent.setTime(currLoc.lastModified()); diff --git a/app/src/main/java/com/reandroid/apkeditor/merge/Merger.java b/app/src/main/java/com/reandroid/apkeditor/merge/Merger.java index f1335fe8..6e3913a8 100644 --- a/app/src/main/java/com/reandroid/apkeditor/merge/Merger.java +++ b/app/src/main/java/com/reandroid/apkeditor/merge/Merger.java @@ -57,7 +57,7 @@ public interface LogListener { } public static void run(InputStream ins, File cacheDir, OutputStream out, Uri xapkUri, Context context, List splits, boolean signApk) throws Exception { - LogUtil.logMessage(R.string.searching); + LogUtil.logMessage(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.searching)); if(ins!=null) { if(xapkUri == null) { @@ -67,7 +67,7 @@ public static void run(InputStream ins, File cacheDir, OutputStream out, Uri xap while (zipEntry != null) { final String name = zipEntry.getName(); if (name.endsWith(".apk")) { - if((splits != null && !splits.isEmpty() && splits.contains(name))) LogUtil.logMessage(context.getString(R.string.skipping) + name + context.getString(R.string.unselected)); + if((splits != null && !splits.isEmpty() && splits.contains(name))) LogUtil.logMessage(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.skipping) + name + com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.unselected)); else { File file = new File(cacheDir, name); String canonicalizedPath = file.getCanonicalPath(); @@ -82,13 +82,13 @@ public static void run(InputStream ins, File cacheDir, OutputStream out, Uri xap fos.close(); LogUtil.logMessage("Extracted " + name); } - } else LogUtil.logMessage(context.getString(R.string.skipping) + name + context.getString(R.string.not_apk)); + } else LogUtil.logMessage(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.skipping) + name + com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.not_apk)); zipEntry = zis.getNextEntry(); } zis.closeEntry(); } } else { - LogUtil.logMessage(R.string.detected_xapk); //ZipInputStream is reading XAPK files as if all files inside the splits were in 1 zip which breaks everything + LogUtil.logMessage(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.detected_xapk)); //ZipInputStream is reading XAPK files as if all files inside the splits were in 1 zip which breaks everything File bruh = DeviceSpecsUtil.splitApkPath == null ? new File(FileUtils.getPath(xapkUri, context)) : DeviceSpecsUtil.splitApkPath; // if file was already copied to get splits list do not copy it again final boolean couldntRead = !bruh.canRead(); if (couldntRead) bruh = FileUtils.copyFileToInternalStorage(xapkUri, context); @@ -100,7 +100,7 @@ public static void run(InputStream ins, File cacheDir, OutputStream out, Uri xap String fileName = entry.getName(); if (fileName.endsWith(".apk")) { - if((splits != null && !splits.isEmpty() && splits.contains(fileName))) LogUtil.logMessage(context.getString(R.string.skipping) + fileName + context.getString(R.string.unselected)); + if((splits != null && !splits.isEmpty() && splits.contains(fileName))) LogUtil.logMessage(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.skipping) + fileName + com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.unselected)); else { File outFile = new File(cacheDir, fileName); File parentDir = outFile.getParentFile(); @@ -117,7 +117,7 @@ public static void run(InputStream ins, File cacheDir, OutputStream out, Uri xap } } } - } else LogUtil.logMessage(context.getString(R.string.skipping) + fileName + context.getString(R.string.not_apk)); + } else LogUtil.logMessage(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.skipping) + fileName + com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.not_apk)); } if(couldntRead) bruh.delete(); } @@ -131,7 +131,7 @@ public static void run(InputStream ins, File cacheDir, OutputStream out, Uri xap ApkModule mergedModule = bundle.mergeModules(); if(mergedModule.hasAndroidManifest()) { AndroidManifestBlock manifest = mergedModule.getAndroidManifest(); - LogUtil.logMessage(R.string.sanitizing_manifest); + LogUtil.logMessage(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.sanitizing_manifest)); int ID_requiredSplitTypes = 0x0101064e; int ID_splitTypes = 0x0101064f; @@ -185,7 +185,7 @@ public static void run(InputStream ins, File cacheDir, OutputStream out, Uri xap continue; } String path = resValue.getValueAsString(); - LogUtil.logMessage(context.getString(R.string.removed_table_entry) + " " + path); + LogUtil.logMessage(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.removed_table_entry) + " " + path); //Remove file entry zipEntryMap.remove(path); // It's not safe to destroy entry, resource id might be used in dex code. @@ -209,12 +209,12 @@ public static void run(InputStream ins, File cacheDir, OutputStream out, Uri xap } manifest.refresh(); } - LogUtil.logMessage((R.string.saving)); + LogUtil.logMessage(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.saving)); if(signApk) { final File temp = new File(cacheDir, "temp.apk"); mergedModule.writeApk(temp); - LogUtil.logMessage(R.string.signing); + LogUtil.logMessage(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.signing)); try (InputStream fis = FileUtils.getInputStream(temp)) { final String FILE_NAME_PAST = "testkey.past"; final String FILE_NAME_PRIVATE_KEY = "testkey.pk8"; @@ -230,7 +230,7 @@ public static void run(InputStream ins, File cacheDir, OutputStream out, Uri xap PseudoApkSigner.sign(fis, out, pastFile, privateKeyFile); } catch (Exception e) { - LogUtil.logMessage(R.string.sign_failed); + LogUtil.logMessage(com.abdurazaaqmohammed.AntiSplit.main.MainActivity.rss.getString(R.string.sign_failed)); mergedModule.writeApk(out); throw(e); // for showError } diff --git a/app/src/main/res/layout-v14/activity_main.xml b/app/src/main/res/layout-v14/activity_main.xml index 45fa5d8f..35c3baac 100644 --- a/app/src/main/res/layout-v14/activity_main.xml +++ b/app/src/main/res/layout-v14/activity_main.xml @@ -88,6 +88,13 @@ android:textSize="20sp" android:text="@string/sign_apk" /> +