reusing text input layout extension
This commit is contained in:
parent
985e1569bf
commit
400d8058e8
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user