mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 03:49:04 +03:00
Create type alias for Text change listener
This commit is contained in:
parent
6dd1bc3385
commit
9724c1b8ce
6 changed files with 16 additions and 5 deletions
|
@ -31,3 +31,9 @@ fun View.onClick(listener: ClickListener?) {
|
||||||
setOnClickListener(DebouncedClickListener(listener))
|
setOnClickListener(DebouncedClickListener(listener))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple Text listener lambda
|
||||||
|
*/
|
||||||
|
typealias TextListener = (String) -> Unit
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.airbnb.epoxy.EpoxyModelClass
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
|
import im.vector.app.core.epoxy.TextListener
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyModel
|
import im.vector.app.core.epoxy.VectorEpoxyModel
|
||||||
import im.vector.app.core.epoxy.addTextChangedListenerOnce
|
import im.vector.app.core.epoxy.addTextChangedListenerOnce
|
||||||
|
@ -63,7 +64,7 @@ abstract class FormEditTextItem : VectorEpoxyModel<FormEditTextItem.Holder>() {
|
||||||
var endIconMode: Int? = null
|
var endIconMode: Int? = null
|
||||||
|
|
||||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
||||||
var onTextChange: ((String) -> Unit)? = null
|
var onTextChange: TextListener? = null
|
||||||
|
|
||||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
||||||
var editorActionListener: TextView.OnEditorActionListener? = null
|
var editorActionListener: TextView.OnEditorActionListener? = null
|
||||||
|
|
|
@ -24,6 +24,7 @@ import com.google.android.material.textfield.TextInputEditText
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.epoxy.ClickListener
|
import im.vector.app.core.epoxy.ClickListener
|
||||||
|
import im.vector.app.core.epoxy.TextListener
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyModel
|
import im.vector.app.core.epoxy.VectorEpoxyModel
|
||||||
import im.vector.app.core.epoxy.addTextChangedListenerOnce
|
import im.vector.app.core.epoxy.addTextChangedListenerOnce
|
||||||
|
@ -47,7 +48,7 @@ abstract class FormEditTextWithButtonItem : VectorEpoxyModel<FormEditTextWithBut
|
||||||
var buttonText: String? = null
|
var buttonText: String? = null
|
||||||
|
|
||||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
||||||
var onTextChange: ((String) -> Unit)? = null
|
var onTextChange: TextListener? = null
|
||||||
|
|
||||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
||||||
var onButtonClicked: ClickListener? = null
|
var onButtonClicked: ClickListener? = null
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.airbnb.epoxy.EpoxyModelClass
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
|
import im.vector.app.core.epoxy.TextListener
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyModel
|
import im.vector.app.core.epoxy.VectorEpoxyModel
|
||||||
import im.vector.app.core.epoxy.addTextChangedListenerOnce
|
import im.vector.app.core.epoxy.addTextChangedListenerOnce
|
||||||
|
@ -59,7 +60,7 @@ abstract class FormMultiLineEditTextItem : VectorEpoxyModel<FormMultiLineEditTex
|
||||||
var typeFace: Typeface = Typeface.DEFAULT
|
var typeFace: Typeface = Typeface.DEFAULT
|
||||||
|
|
||||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
||||||
var onTextChange: ((String) -> Unit)? = null
|
var onTextChange: TextListener? = null
|
||||||
|
|
||||||
private val onTextChangeListener = object : SimpleTextWatcher() {
|
private val onTextChangeListener = object : SimpleTextWatcher() {
|
||||||
override fun afterTextChanged(s: Editable) {
|
override fun afterTextChanged(s: Editable) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.airbnb.epoxy.EpoxyModelClass
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
|
import im.vector.app.core.epoxy.TextListener
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyModel
|
import im.vector.app.core.epoxy.VectorEpoxyModel
|
||||||
import im.vector.app.core.epoxy.addTextChangedListenerOnce
|
import im.vector.app.core.epoxy.addTextChangedListenerOnce
|
||||||
|
@ -50,7 +51,7 @@ abstract class RoomAliasEditItem : VectorEpoxyModel<RoomAliasEditItem.Holder>()
|
||||||
var enabled: Boolean = true
|
var enabled: Boolean = true
|
||||||
|
|
||||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
||||||
var onTextChange: ((String) -> Unit)? = null
|
var onTextChange: TextListener? = null
|
||||||
|
|
||||||
private val onTextChangeListener = object : SimpleTextWatcher() {
|
private val onTextChangeListener = object : SimpleTextWatcher() {
|
||||||
override fun afterTextChanged(s: Editable) {
|
override fun afterTextChanged(s: Editable) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.google.android.material.textfield.TextInputEditText
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.epoxy.ClickListener
|
import im.vector.app.core.epoxy.ClickListener
|
||||||
|
import im.vector.app.core.epoxy.TextListener
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyModel
|
import im.vector.app.core.epoxy.VectorEpoxyModel
|
||||||
import im.vector.app.core.epoxy.addTextChangedListenerOnce
|
import im.vector.app.core.epoxy.addTextChangedListenerOnce
|
||||||
|
@ -45,7 +46,7 @@ abstract class LoginPasswordFormItem : VectorEpoxyModel<LoginPasswordFormItem.Ho
|
||||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var passwordRevealClickListener: ClickListener? = null
|
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var passwordRevealClickListener: ClickListener? = null
|
||||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var forgetPasswordClickListener: ClickListener? = null
|
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var forgetPasswordClickListener: ClickListener? = null
|
||||||
@EpoxyAttribute var submitClickListener: ((String) -> Unit)? = null
|
@EpoxyAttribute var submitClickListener: ((String) -> Unit)? = null
|
||||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var onPasswordEdited: ((String) -> Unit)? = null
|
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var onPasswordEdited: TextListener? = null
|
||||||
|
|
||||||
private val textChangeListener = object : SimpleTextWatcher() {
|
private val textChangeListener = object : SimpleTextWatcher() {
|
||||||
override fun afterTextChanged(s: Editable) {
|
override fun afterTextChanged(s: Editable) {
|
||||||
|
|
Loading…
Reference in a new issue