Merge branch 'Fox2Code:master' into master

pull/107/head
Der_Googler 2 years ago committed by GitHub
commit 7b186dc257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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"
}

@ -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() {

@ -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;
}

@ -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;

@ -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();
}

@ -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;

@ -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/" +

@ -11,6 +11,7 @@
<string name="failed_download">Descărcarea fișierului a eșuat.</string>
<string name="slow_modules">A durat prea mult pentru pornirea modulelor, ia în considerare dezactivarea unor module</string>
<string name="fail_internet">Conectarea la internet a eșuat</string>
<string name="no_web_view">Nu s-a putut obține WebView de sistem</string>
<string name="title_activity_settings">Setări activitate</string>
<string name="app_update_available">Actualizare aplicație disponibilă</string>
<string name="app_update">Actualizați</string>
@ -87,4 +88,5 @@
<string name="enable_blur_pref">Activează estomparea</string>
<string name="repo_enabled">Depozit activat</string>
<string name="repo_disabled">Depozit dezactivat</string>
<string name="androidacy_repo_info">Depozitul Androidacy utilizează reclame și instrumente de urmărire.</string>
</resources>

@ -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

Loading…
Cancel
Save