mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
reusing text input layout extension
This commit is contained in:
parent
985e1569bf
commit
400d8058e8
1 changed files with 3 additions and 4 deletions
|
@ -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…
Reference in a new issue