From 3722ce4cb2533192ba5f0aed836a92604496498a Mon Sep 17 00:00:00 2001
From: Vera-Firefly <1964762970@qq.com>
Date: Sat, 17 Aug 2024 09:59:39 +0800
Subject: [PATCH] Fix the problem that custom GL/GLSL is still used after it is
turned on or off
---
.../LauncherPreferenceExperimentalFragment.java | 15 +++++++--------
.../src/main/res/xml/pref_experimental.xml | 3 ++-
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceExperimentalFragment.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceExperimentalFragment.java
index cec4106b7..6418be4e3 100644
--- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceExperimentalFragment.java
+++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceExperimentalFragment.java
@@ -41,11 +41,6 @@ public void onCreatePreferences(Bundle b, String str) {
addPreferencesFromResource(R.xml.pref_experimental);
computeVisibility();
- findPreference("SetGLVersion").setOnPreferenceClickListener((preference) -> {
- showSetGLVersionDialog();
- return true;
- });
-
final Preference downloadMesa = requirePreference("DownloadMesa", Preference.class);
downloadMesa.setOnPreferenceClickListener((a)-> {
loadMesaList();
@@ -98,12 +93,11 @@ public void onCreatePreferences(Bundle b, String str) {
return true;
});
- SwitchPreference setGLVersion = requirePreference("SetGLVersion", SwitchPreference.class);
+ SwitchPreference setGLVersion = requirePreference("ebCustom", SwitchPreference.class);
setGLVersion.setOnPreferenceChangeListener((p, v) -> {
boolean set = (boolean) v;
if (!set) return false;
closeOtherCustomMesaPref(customMesaVersionPref);
- LauncherPreferences.DEFAULT_PREF.edit().putBoolean("ebCustom", true).apply();
return true;
});
setGLVersion.setOnPreferenceClickListener(preference -> {
@@ -235,7 +229,12 @@ private void showSetGLVersionDialog() {
.putString("mesaGLSLVersion", LauncherPreferences.PREF_MESA_GLSL_VERSION)
.apply();
})
- .setNegativeButton(R.string.alertdialog_cancel, null)
+ .setNegativeButton(R.string.alertdialog_cancel, (dia, i) -> {
+ LauncherPreferences.DEFAULT_PREF.edit()
+ .putBoolean("ebCustom", false)
+ .putBoolean("ebSystem", true)
+ .apply();
+ })
.create();
dialog.show();
}
diff --git a/app_pojavlauncher/src/main/res/xml/pref_experimental.xml b/app_pojavlauncher/src/main/res/xml/pref_experimental.xml
index aba2ef7d2..8790d4997 100644
--- a/app_pojavlauncher/src/main/res/xml/pref_experimental.xml
+++ b/app_pojavlauncher/src/main/res/xml/pref_experimental.xml
@@ -87,13 +87,14 @@