Created
February 11, 2018 21:06
-
-
Save dcampogiani/0c04304d56f6b27252296297a3490096 to your computer and use it in GitHub Desktop.
This file contains 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
fun handleInvalid(errors: Nel<ValidationError>) { | |
errors.map { handleInvalidField(it) }.all.forEach { it.second.error = it.first } | |
} | |
fun handleInvalidField(validationError: ValidationError): Pair<String, TextInputLayout> = | |
when (validationError) { | |
ValidationError.InvalidMail -> Pair(getString(R.string.invalid_mail), emailWrapper) | |
ValidationError.InvalidPhoneNumber -> Pair(getString(R.string.invalid_phone_number), numberWrapper) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment