Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
settings: disable gamma option when gles1 is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
xyzz committed Oct 6, 2019
1 parent a4cf252 commit 91bce98
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/src/main/java/ui/fragments/FragmentSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class FragmentSettings : PreferenceFragment(), OnSharedPreferenceChangeListener
addPreferencesFromResource(R.xml.settings)
preferenceScreen.sharedPreferences.registerOnSharedPreferenceChangeListener(this)

updateGammaState()

findPreference("pref_controls").setOnPreferenceClickListener {
val intent = Intent(activity, ConfigureControls::class.java)
this.startActivity(intent)
Expand Down Expand Up @@ -153,6 +155,7 @@ class FragmentSettings : PreferenceFragment(), OnSharedPreferenceChangeListener

override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
updatePreference(findPreference(key), key)
updateGammaState()
}

private fun updatePreference(preference: Preference?, key: String) {
Expand All @@ -172,4 +175,13 @@ class FragmentSettings : PreferenceFragment(), OnSharedPreferenceChangeListener
}
}

/**
* @brief Disable gamma preference if GLES1 is selected
*/
private fun updateGammaState() {
val sharedPref = preferenceScreen.sharedPreferences
findPreference("pref_gamma").isEnabled =
sharedPref.getString("pref_graphicsLibrary_v2", "") != "gles1"
}

}

0 comments on commit 91bce98

Please sign in to comment.