diff --git a/app/build.gradle b/app/build.gradle
index 3bbfc84..6b3bf86 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,8 +10,8 @@ android {
applicationId "com.fox2code.mmm"
minSdk 21
targetSdk 32
- versionCode 38
- versionName "0.4.3"
+ versionCode 39
+ versionName "0.4.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
diff --git a/app/src/main/java/com/fox2code/mmm/ActionButtonType.java b/app/src/main/java/com/fox2code/mmm/ActionButtonType.java
index 3569d58..bd5f1c7 100644
--- a/app/src/main/java/com/fox2code/mmm/ActionButtonType.java
+++ b/app/src/main/java/com/fox2code/mmm/ActionButtonType.java
@@ -1,9 +1,11 @@
package com.fox2code.mmm;
import android.content.Context;
+import android.text.Spanned;
import android.util.Log;
import android.widget.Button;
import android.widget.ImageButton;
+import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.DrawableRes;
@@ -77,12 +79,13 @@ public enum ActionButtonType {
builder.setTitle(moduleInfo.name).setCancelable(true)
.setIcon(R.drawable.ic_baseline_extension_24);
CharSequence desc = moduleInfo.description;
+ Markwon markwon = null;
if (moduleInfo instanceof LocalModuleInfo) {
LocalModuleInfo localModuleInfo = (LocalModuleInfo) moduleInfo;
if (!localModuleInfo.updateChangeLog.isEmpty()) {
- Markwon markwon = MainApplication.getINSTANCE().getMarkwon();
+ markwon = MainApplication.getINSTANCE().getMarkwon();
// Re-render each time in cse of config changes
- desc = markwon.render(markwon.parse(localModuleInfo.updateChangeLog));
+ desc = markwon.toMarkdown(localModuleInfo.updateChangeLog);
}
}
@@ -111,6 +114,11 @@ public enum ActionButtonType {
alertButton.setPadding(dim5dp, dim5dp, dim5dp, dim5dp);
}
}
+ if (markwon != null) {
+ TextView messageView = alertDialog.getWindow()
+ .findViewById(android.R.id.message);
+ markwon.setParsedMarkdown(messageView, (Spanned) desc);
+ }
}
},
UNINSTALL() {
diff --git a/app/src/main/java/com/fox2code/mmm/compat/CompatActivity.java b/app/src/main/java/com/fox2code/mmm/compat/CompatActivity.java
index aaa739f..9a944d9 100644
--- a/app/src/main/java/com/fox2code/mmm/compat/CompatActivity.java
+++ b/app/src/main/java/com/fox2code/mmm/compat/CompatActivity.java
@@ -265,31 +265,30 @@ public class CompatActivity extends AppCompatActivity {
}
@Dimension @Px
- public int getStatusBarHeight() { // How to improve this?
+ public int getStatusBarHeight() {
int height = WindowInsetsCompat.CONSUMED.getInsets(
WindowInsetsCompat.Type.statusBars()).top;
- if (height == 0) { // Fallback to system resources
- int id = Resources.getSystem().getIdentifier(
- "status_bar_height", "dimen", "android");
- if (id > 0) return Resources.getSystem().getDimensionPixelSize(id);
- }
- return height;
+ // Check system resources
+ int id = Resources.getSystem().getIdentifier(
+ "status_bar_height", "dimen", "android");
+ return id <= 0 ? height : Math.max(height,
+ Resources.getSystem().getDimensionPixelSize(id));
}
public int getNavigationBarHeight() {
int height = WindowInsetsCompat.CONSUMED.getInsets(
WindowInsetsCompat.Type.navigationBars()).bottom;
- if (height == 0) { // Fallback to system resources
- int id = Resources.getSystem().getIdentifier(
- "config_showNavigationBar", "bool", "android");
- Log.d(TAG, "Nav 1: " + id);
- if ((id > 0 && Resources.getSystem().getBoolean(id))
- || !this.hasHardwareNavBar()) {
- id = Resources.getSystem().getIdentifier(
- "navigation_bar_height", "dimen", "android");
- Log.d(TAG, "Nav 2: " + id);
- if (id > 0) return Resources.getSystem().getDimensionPixelSize(id);
- }
+ // Check system resources
+ int id = Resources.getSystem().getIdentifier(
+ "config_showNavigationBar", "bool", "android");
+ Log.d(TAG, "Nav 1: " + id);
+ if ((id > 0 && Resources.getSystem().getBoolean(id))
+ || !this.hasHardwareNavBar()) {
+ id = Resources.getSystem().getIdentifier(
+ "navigation_bar_height", "dimen", "android");
+ Log.d(TAG, "Nav 2: " + id);
+ return id <= 0 ? height : Math.max(height,
+ Resources.getSystem().getDimensionPixelSize(id));
}
return height;
}
diff --git a/app/src/main/java/com/fox2code/mmm/manager/LocalModuleInfo.java b/app/src/main/java/com/fox2code/mmm/manager/LocalModuleInfo.java
index ee4c52e..4096a0a 100644
--- a/app/src/main/java/com/fox2code/mmm/manager/LocalModuleInfo.java
+++ b/app/src/main/java/com/fox2code/mmm/manager/LocalModuleInfo.java
@@ -2,6 +2,7 @@ package com.fox2code.mmm.manager;
import android.util.Log;
+import com.fox2code.mmm.markdown.MarkdownUrlLinker;
import com.fox2code.mmm.utils.FastException;
import com.fox2code.mmm.utils.Http;
import com.fox2code.mmm.utils.PropUtils;
@@ -48,6 +49,7 @@ public class LocalModuleInfo extends ModuleInfo {
this.updateVersion.trim(), this.updateVersionCode);
if (this.updateChangeLog.length() > 1000)
this.updateChangeLog = this.updateChangeLog.substring(0, 1000);
+ this.updateChangeLog = MarkdownUrlLinker.urlLinkify(this.updateChangeLog);
} catch (Exception e) {
this.updateVersion = null;
this.updateVersionCode = Long.MIN_VALUE;
diff --git a/app/src/main/java/com/fox2code/mmm/utils/Files.java b/app/src/main/java/com/fox2code/mmm/utils/Files.java
index 590580c..edf6b83 100644
--- a/app/src/main/java/com/fox2code/mmm/utils/Files.java
+++ b/app/src/main/java/com/fox2code/mmm/utils/Files.java
@@ -1,5 +1,9 @@
package com.fox2code.mmm.utils;
+import android.os.Build;
+
+import androidx.annotation.NonNull;
+
import com.topjohnwu.superuser.io.SuFile;
import com.topjohnwu.superuser.io.SuFileInputStream;
import com.topjohnwu.superuser.io.SuFileOutputStream;
@@ -18,6 +22,8 @@ import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
public class Files {
+ private static final boolean is64bit = Build.SUPPORTED_64_BIT_ABIS.length > 0;
+
public static void write(File file, byte[] bytes) throws IOException {
try (OutputStream outputStream = new FileOutputStream(file)) {
outputStream.write(bytes);
@@ -63,8 +69,24 @@ public class Files {
} catch (IOException ignored) {}
}
+ public static ByteArrayOutputStream makeBuffer(long capacity) {
+ // Cap buffer to 1 Gib (or 512 Mib for 32bit) to avoid memory errors
+ return Files.makeBuffer((int) Math.min(capacity, is64bit ? 0x40000000 : 0x20000000));
+ }
+
+ public static ByteArrayOutputStream makeBuffer(int capacity) {
+ return new ByteArrayOutputStream(Math.max(0x20, capacity)) {
+ @NonNull
+ @Override
+ public byte[] toByteArray() {
+ return this.buf.length == this.count ?
+ this.buf : super.toByteArray();
+ }
+ };
+ }
+
public static byte[] readAllBytes(InputStream inputStream) throws IOException {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ByteArrayOutputStream buffer = Files.makeBuffer(inputStream.available());
copy(inputStream, buffer);
return buffer.toByteArray();
}
diff --git a/app/src/main/java/com/fox2code/mmm/utils/Http.java b/app/src/main/java/com/fox2code/mmm/utils/Http.java
index 9518aad..0868711 100644
--- a/app/src/main/java/com/fox2code/mmm/utils/Http.java
+++ b/app/src/main/java/com/fox2code/mmm/utils/Http.java
@@ -225,8 +225,7 @@ public class Http {
byte[] buff = new byte[1024 * 4];
long downloaded = 0;
long target = responseBody.contentLength();
- ByteArrayOutputStream byteArrayOutputStream =
- new ByteArrayOutputStream();
+ ByteArrayOutputStream byteArrayOutputStream = Files.makeBuffer(target);
int divider = 1; // Make everything go in an int
while ((target / divider) > (Integer.MAX_VALUE / 2)) {
divider *= 2;
diff --git a/app/src/main/java/com/fox2code/mmm/utils/PropUtils.java b/app/src/main/java/com/fox2code/mmm/utils/PropUtils.java
index 9e005c7..8d4e6ea 100644
--- a/app/src/main/java/com/fox2code/mmm/utils/PropUtils.java
+++ b/app/src/main/java/com/fox2code/mmm/utils/PropUtils.java
@@ -70,6 +70,11 @@ public class PropUtils {
GH_UC + "3arthur6/BluetoothLibraryPatcher/master/update.json");
moduleUpdateJsonFallbacks.put("Detach",
GH_UC + "xerta555/Detach-Files/blob/master/Updater.json");
+ for (String module : new String[]{"busybox-ndk", "adb-ndk", "twrp-keep",
+ "adreno-dev", "nano-ndk", "zipsigner", "nexusmedia", "mtd-ndk"}) {
+ moduleUpdateJsonFallbacks.put(module,
+ GH_UC + "Magisk-Modules-Repo/" + module + "/master/update.json");
+ }
moduleUpdateJsonFallbacks.put("riru_ifw_enhance", "https://github.com/" +
"Kr328/Riru-IFWEnhance/releases/latest/download/riru-ifw-enhance.json");
moduleUpdateJsonFallbacks.put("zygisk_ifw_enhance", "https://github.com/" +
diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml
index f67a0e0..77e0b86 100644
--- a/app/src/main/res/values-ro/strings.xml
+++ b/app/src/main/res/values-ro/strings.xml
@@ -11,6 +11,7 @@
Descărcarea fișierului a eșuat.
A durat prea mult pentru pornirea modulelor, ia în considerare dezactivarea unor module
Conectarea la internet a eșuat
+ Nu s-a putut obține WebView de sistem
Setări activitate
Actualizare aplicație disponibilă
Actualizați
@@ -87,4 +88,5 @@
Activează estomparea
Depozit activat
Depozit dezactivat
+ Depozitul Androidacy utilizează reclame și instrumente de urmărire.
diff --git a/build.gradle b/build.gradle
index 132cd57..e8328d2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,9 +5,9 @@ buildscript {
mavenCentral()
gradlePluginPortal()
}
- project.ext.latestAboutLibsRelease = "10.0.1"
+ project.ext.latestAboutLibsRelease = "10.1.0"
dependencies {
- classpath 'com.android.tools.build:gradle:7.1.2'
+ classpath 'com.android.tools.build:gradle:7.1.3'
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${latestAboutLibsRelease}"
// NOTE: Do not place your application dependencies here; they belong