Unregister shared preferences properly
This commit is contained in:
parent
15ffb5b596
commit
ac70c89eee
1 changed files with 7 additions and 0 deletions
|
@ -112,6 +112,13 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
outState.putInt("id", pluginId)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
PreferenceManager
|
||||
.getDefaultSharedPreferences(context)
|
||||
.unregisterOnSharedPreferenceChangeListener(this)
|
||||
}
|
||||
|
||||
private fun addPreferencesFromResourceIfEnabled(p: PluginBase?, rootKey: String?, enabled: Boolean) {
|
||||
if (enabled) addPreferencesFromResourceIfEnabled(p, rootKey)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue