fix some prefs

This commit is contained in:
Bnyro 2022-09-23 14:15:55 +02:00
parent 845b6fe2ad
commit 6e663cff41

View File

@ -36,7 +36,10 @@ open class MaterialPreferenceFragment : PreferenceFragmentCompat() {
preference.callChangeListener(newValue)
// invoke the on change listeners
preference.callChangeListener(preference.value)
if (preference.callChangeListener(newValue)) {
preference.value = newValue
}
dialog.dismiss()
}
.setNegativeButton(R.string.cancel, null)
.show()
@ -52,14 +55,13 @@ open class MaterialPreferenceFragment : PreferenceFragmentCompat() {
MaterialAlertDialogBuilder(requireContext())
.setTitle(preference.title)
.setView(binding.root)
.setPositiveButton(R.string.okay) { _, _ ->
// save the new value
preference.text = binding.input.text.toString()
// invoke the on change listeners
preference.callChangeListener(preference.text)
.setPositiveButton(android.R.string.ok) { _, _ ->
val newValue = binding.input.text.toString()
if (preference.callChangeListener(newValue)) {
preference.text = newValue
}
.setNegativeButton(R.string.cancel, null)
}
.setNegativeButton(android.R.string.cancel, null)
.show()
}
/**