mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-17 11:48:51 +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…
Add table
Reference in a new issue