Skip to content

Commit

Permalink
FIX: Input text elements does not require initial value
Browse files Browse the repository at this point in the history
  • Loading branch information
Zdeněk Balák committed May 3, 2019
1 parent 3a44b00 commit 21abcb8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import cz.qase.android.formbuilderlibrary.validator.FormValidator
open class EditTextElement(
protected val hint: String?,
protected val hintRes: Int?,
protected var text: String? = null,
protected val text: String? = null,
private val valueChangeListener: ValueCallback<String>?,
formValidators: MutableList<FormValidator<String>> = ArrayList()) : FormElementValidatable<String>(formValidators) {

Expand Down Expand Up @@ -51,7 +51,6 @@ open class EditTextElement(
editText?.setText(text)
editText?.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable) {
text = s.toString()
positiveValidation()
valueChangeListener?.callback(s.toString())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ import cz.qase.android.formbuilderlibrary.validator.FormValidator


class LabelInputElement(private val label: String,
private var hint: String,
private var value: String,
private val hint: String,
private val value: String? = null,
private val valueChangeListener: ValueCallback<String>,
formValidators: MutableList<FormValidator<String>> = ArrayList(),
private val groupComponent: Int = R.layout.form_group_item_inline,
private val headerComponent: Int = R.layout.form_inline_label,
private val inputComponent: Int = R.layout.form_text_input_layout,
private val formStyleBundle: FormStyleBundle? = null) : FormElementValidatable<String>(formValidators) {
override fun getVal(): String? {
return value
return textInputEditText?.text.toString()
}

private var labelView: TextView? = null
Expand Down Expand Up @@ -59,7 +59,6 @@ class LabelInputElement(private val label: String,
textInputEditText?.addTextChangedListener(
object : TextWatcher {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
value = s.toString()
positiveValidation()
valueChangeListener.callback(s.toString())

Expand Down

0 comments on commit 21abcb8

Please sign in to comment.