reusing text input layout extension

This commit is contained in:
Adam Brown 2022-07-13 15:31:09 +01:00
parent 985e1569bf
commit 400d8058e8

View file

@ -44,10 +44,9 @@ fun TextInputLayout.content() = editText().text.toString()
fun TextInputLayout.hasContent() = !editText().text.isNullOrEmpty()
fun TextInputLayout.clearErrorOnChange(lifecycleOwner: LifecycleOwner) {
editText()
.textChanges()
.onEach { error = null }
.launchIn(lifecycleOwner.lifecycleScope)
onTextChange(lifecycleOwner) {
error = null
}
}
fun TextInputLayout.onTextChange(lifecycleOwner: LifecycleOwner, action: (CharSequence) -> Unit) {