TheDukerChip
06/25/2019, 11:13 AMdata class FormData(
private var _email: String = "",
private var _password: String = "",
private var _isAllFieldsValid: Boolean = false
) : BaseObservable() {
var email: String
@Bindable get() = _email
set(value) {
_email = value
notifyPropertyChanged(BR.email)
}
var password: String
@Bindable get() = _password
set(value) {
_password = value
notifyPropertyChanged(BR.password)
}
// I want this function to be notifed for both email and password changes
fun onValuesChanged() {
}
}
Is there any way to achieve this rather than callback or observer?shikasd
06/25/2019, 1:09 PMobservable
property delegate, probably that will work for youPaulius Ruminas
06/25/2019, 1:34 PMvar email: String
@Bindable get() = _email
set(value) {
_email = value
onValuesChanged()
notifyPropertyChanged(BR.email)
}
var password: String
@Bindable get() = _password
set(value) {
_password = value
onValuesChanged()
notifyPropertyChanged(BR.password)
}