fix: Move about preference to the top

This commit is contained in:
LisoUseInAIKyrios 2024-04-07 16:32:38 +04:00
parent 6bdc1fdb7a
commit a757b6700e
2 changed files with 7 additions and 6 deletions

View File

@ -35,6 +35,7 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import app.revanced.integrations.shared.settings.BooleanSetting;
import app.revanced.integrations.shared.settings.preference.ReVancedAboutPreference;
import kotlin.text.Regex;
public class Utils {
@ -530,8 +531,9 @@ public class Utils {
for (Preference pref : preferences.values()) {
int order = index++;
// If the preference is a PreferenceScreen or is an intent preference, move to the top.
if (pref instanceof PreferenceScreen || pref.getIntent() != null) {
// Move any screens, intents, and the one off About preference to the top.
if (pref instanceof PreferenceScreen || pref instanceof ReVancedAboutPreference
|| pref.getIntent() != null) {
// Arbitrary high number.
order -= 1000;
}

View File

@ -172,10 +172,9 @@ public class ReVancedAboutPreference extends Preference {
String backgroundColorHex = getResourceColorHexString(isDarkMode ? getDarkColor() : getLightColor());
String foregroundColorHex = getResourceColorHexString(isDarkMode ? getLightColor() : getDarkColor());
// Apply light/dark mode colors.
builder.append("<style>")
.append("body { background-color: ").append(backgroundColorHex).append("; color: ").append(foregroundColorHex).append(" }")
.append("a { color: ").append(foregroundColorHex).append("; }")
.append("</style>");
builder.append(String.format(
"<style> body { background-color: %s; color: %s; } a { color: %s; } </style>",
backgroundColorHex, foregroundColorHex, foregroundColorHex));
if (isNetworkConnected) {
builder.append("<img style=\"width: 100px; height: 100px;\" "