Skip to content

Commit

Permalink
1.6.3.4
Browse files Browse the repository at this point in the history
Add Indonesian translation by @teddysulaimanGL
Add language picker in app
Add border to dialogs
Change background color and add border to buttons
  • Loading branch information
AbdurazaaqMohammed committed Aug 6, 2024
1 parent 12adac2 commit 02f4ee9
Show file tree
Hide file tree
Showing 34 changed files with 268 additions and 111 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 = 18
versionName = "1.6.3.3"
versionCode = 19
versionName = "1.6.3.4"
multiDexEnabled = true
}

Expand Down
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions app/src/main/java/ankur035/LocaleHelper.java
Original file line number Diff line number Diff line change
@@ -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;
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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());
Expand Down Expand Up @@ -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());
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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());
Expand Down
22 changes: 11 additions & 11 deletions app/src/main/java/com/reandroid/apkeditor/merge/Merger.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public interface LogListener {
}

public static void run(InputStream ins, File cacheDir, OutputStream out, Uri xapkUri, Context context, List<String> 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) {
Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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();
}
Expand All @@ -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;

Expand Down Expand Up @@ -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.
Expand All @@ -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";
Expand All @@ -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
}
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/layout-v14/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@
android:textSize="20sp"
android:text="@string/sign_apk" />

<Button
android:id="@+id/langPicker"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="@string/lang" />

<Button
android:id="@+id/revanced"
android:layout_width="fill_parent"
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@
android:id="@+id/signToggle"
android:layout_height="wrap_content" android:layout_width="match_parent"/>

<Button
android:id="@+id/langPicker"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="@string/lang" />

<Button
android:id="@+id/revanced"
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
5 changes: 2 additions & 3 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Binary file not shown.
8 changes: 0 additions & 8 deletions app/src/main/res/values-de/strings.xml

This file was deleted.

8 changes: 0 additions & 8 deletions app/src/main/res/values-es/strings.xml

This file was deleted.

8 changes: 0 additions & 8 deletions app/src/main/res/values-fr/strings.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
<string name="last_edit">Terakhir kali disunting: </string>
<string name="error_dir_access">Direktorinya tidak bisa diakses</string>
<string name="label_parent_dir" translatable="false">...</string>
</resources>
</resources>
8 changes: 0 additions & 8 deletions app/src/main/res/values-zh-rTW/strings.xml

This file was deleted.

4 changes: 4 additions & 0 deletions app/src/main/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#000000</color>
</resources>
Loading

0 comments on commit 02f4ee9

Please sign in to comment.