Validations

Not Empty:

val notEmpty: (TextView) -> Boolean = { it.text.isNotEmpty() }

Email:

val isEmail: (TextView) -> Boolean = { Patterns.EMAIL_ADDRESS
    .matcher(it.text).matches() }

Kotlin Tips: When a lambda expression has a single parameter, it can be referred to using the it keyword. Kotlin has no ternary operator, and uses if/else statements in its place.

results matching ""

    No results matching ""