Last active
March 7, 2018 08:39
-
-
Save jakubkinst/b09ad19c6524f15af2df3647bd014097 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val email = mutableLiveDataOf(defaultEmail) | |
val password = mutableLiveDataOf(defaultPassword) | |
val formValid = MediatorLiveData<Boolean>().apply { | |
addSource(email, {value = validateForm(email.value, password.value)}) | |
addSource(password, {value = validateForm(email.value, password.value)}) | |
} | |
private fun validateForm(email: String, password: String): Boolean | |
= validateEmail(email) && validatePassword(password, config.MIN_PASSWORD_LENGTH) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment