Closed jscti closed 8 months ago
Are you talking about the KotPreference
implemention?
Otherwise, it's really simple:
state.value
as value
to the preferencestate.value
in the onValueChange
callbackI will add the cancel option to the KotPreference
implementation though
I just saw, that the bool preference did hold an unnecessary internal state that prevented it from being cancelable. Should be possible now and I also added this feature for the KotPreference
version
Great thank you, it works now No I wasn't using the KOT implementation
Hi there
It would be nice to be able to cancel a value change with
onValueChanged
.Use Case / example :
or any other case needing a custom check
I implemented it in a custom Preference and the changes are really small but maybe that could/should be a core feature of your lib :
Without this, it's painfull to revert the switch back on the "disabled" state. I needed to play with delay() to update the preference storage AFTER the onValueChanged finished its job and actually enabled the switch