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.hasContent() = !editText().text.isNullOrEmpty()
|
||||||
|
|
||||||
fun TextInputLayout.clearErrorOnChange(lifecycleOwner: LifecycleOwner) {
|
fun TextInputLayout.clearErrorOnChange(lifecycleOwner: LifecycleOwner) {
|
||||||
editText()
|
onTextChange(lifecycleOwner) {
|
||||||
.textChanges()
|
error = null
|
||||||
.onEach { error = null }
|
}
|
||||||
.launchIn(lifecycleOwner.lifecycleScope)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun TextInputLayout.onTextChange(lifecycleOwner: LifecycleOwner, action: (CharSequence) -> Unit) {
|
fun TextInputLayout.onTextChange(lifecycleOwner: LifecycleOwner, action: (CharSequence) -> Unit) {
|
||||||
|
Loading…
Reference in New Issue
Block a user