Skip to content

Commit

Permalink
Fix the problem that custom GL/GLSL is still used after it is turned …
Browse files Browse the repository at this point in the history
…on or off
  • Loading branch information
Vera-Firefly committed Aug 17, 2024
1 parent a22e0e7 commit 3722ce4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 -> {
Expand Down Expand Up @@ -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();
}
Expand Down
3 changes: 2 additions & 1 deletion app_pojavlauncher/src/main/res/xml/pref_experimental.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@
<SwitchPreference
android:key="ebSystem"
android:title="@string/preference_exp_ebsystem"
android:defaultValue="true"
app2:iconSpaceReserved="false"/>
<SwitchPreference
android:key="ebSpecific"
android:title="@string/preference_exp_ebspecific"
app2:iconSpaceReserved="false"/>
<SwitchPreference
android:key="SetGLVersion"
android:key="ebCustom"
android:title="@string/preference_rendererexp_custom_glversion_title"
android:summary="@string/preference_rendererexp_custom_glversion"
app2:iconSpaceReserved="false"/>
Expand Down

0 comments on commit 3722ce4

Please sign in to comment.