File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
vector/src/main/java/im/vector/app/core/extensions Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -44,11 +44,18 @@ fun TextInputLayout.content() = editText().text.toString()
4444fun TextInputLayout.hasContent () = ! editText().text.isNullOrEmpty()
4545
4646fun TextInputLayout.clearErrorOnChange (lifecycleOwner : LifecycleOwner ) {
47- editText().textChanges()
47+ editText()
48+ .textChanges()
4849 .onEach { error = null }
4950 .launchIn(lifecycleOwner.lifecycleScope)
5051}
5152
53+ fun TextInputLayout.onTextChange (lifecycleOwner : LifecycleOwner , action : (CharSequence ) -> Unit ) {
54+ editText().textChanges()
55+ .onEach(action)
56+ .launchIn(lifecycleOwner.lifecycleScope)
57+ }
58+
5259fun TextInputLayout.associateContentStateWith (button : View , enabledPredicate : (String ) -> Boolean = { it.isNotEmpty() }) {
5360 button.isEnabled = enabledPredicate(content())
5461 editText().addTextChangedListener(object : SimpleTextWatcher () {
You can’t perform that action at this time.
0 commit comments