Fix Markdown changelog links not opening. Fix #132 (Again)

pull/27/head
Fox2Code 3 years ago
parent 6ecf659208
commit 2e84e46402

@ -1,9 +1,11 @@
package com.fox2code.mmm; package com.fox2code.mmm;
import android.content.Context; import android.content.Context;
import android.text.Spanned;
import android.util.Log; import android.util.Log;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.DrawableRes; import androidx.annotation.DrawableRes;
@ -76,12 +78,13 @@ public enum ActionButtonType {
builder.setTitle(moduleInfo.name).setCancelable(true) builder.setTitle(moduleInfo.name).setCancelable(true)
.setIcon(R.drawable.ic_baseline_extension_24); .setIcon(R.drawable.ic_baseline_extension_24);
CharSequence desc = moduleInfo.description; CharSequence desc = moduleInfo.description;
Markwon markwon = null;
if (moduleInfo instanceof LocalModuleInfo) { if (moduleInfo instanceof LocalModuleInfo) {
LocalModuleInfo localModuleInfo = (LocalModuleInfo) moduleInfo; LocalModuleInfo localModuleInfo = (LocalModuleInfo) moduleInfo;
if (!localModuleInfo.updateChangeLog.isEmpty()) { if (!localModuleInfo.updateChangeLog.isEmpty()) {
Markwon markwon = MainApplication.getINSTANCE().getMarkwon(); markwon = MainApplication.getINSTANCE().getMarkwon();
// Re-render each time in cse of config changes // Re-render each time in cse of config changes
desc = markwon.render(markwon.parse(localModuleInfo.updateChangeLog)); desc = markwon.toMarkdown(localModuleInfo.updateChangeLog);
} }
} }
@ -110,6 +113,11 @@ public enum ActionButtonType {
alertButton.setPadding(dim5dp, dim5dp, dim5dp, dim5dp); alertButton.setPadding(dim5dp, dim5dp, dim5dp, dim5dp);
} }
} }
if (markwon != null) {
TextView messageView = alertDialog.getWindow()
.findViewById(android.R.id.message);
markwon.setParsedMarkdown(messageView, (Spanned) desc);
}
} }
}, },
UNINSTALL() { UNINSTALL() {

@ -68,6 +68,8 @@ public class PropUtils {
final String GH_UC = "https://raw.githubusercontent.com/"; final String GH_UC = "https://raw.githubusercontent.com/";
moduleUpdateJsonFallbacks.put("BluetoothLibraryPatcher", moduleUpdateJsonFallbacks.put("BluetoothLibraryPatcher",
GH_UC + "3arthur6/BluetoothLibraryPatcher/master/update.json"); GH_UC + "3arthur6/BluetoothLibraryPatcher/master/update.json");
moduleUpdateJsonFallbacks.put("busybox-ndk",
GH_UC + "Magisk-Modules-Repo/busybox-ndk/master/update.json");
moduleUpdateJsonFallbacks.put("Detach", moduleUpdateJsonFallbacks.put("Detach",
GH_UC + "xerta555/Detach-Files/blob/master/Updater.json"); GH_UC + "xerta555/Detach-Files/blob/master/Updater.json");
moduleUpdateJsonFallbacks.put("riru_ifw_enhance", "https://github.com/" + moduleUpdateJsonFallbacks.put("riru_ifw_enhance", "https://github.com/" +

Loading…
Cancel
Save