Skip to content

Commit

Permalink
FIX: value change listener is not mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
Zdeněk Balák committed May 3, 2019
1 parent 761b10c commit 699eee6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import java.util.Locale
class LabelDateTimeElement(private val label: String,
private var hint: String,
private var supportFragmentManager: FragmentManager,
private val valueChangeListener: ValueCallback<DateTime>,
private val valueChangeListener: ValueCallback<DateTime>?,
private var value: DateTime? = null,
private var sdf: SimpleDateFormat = SimpleDateFormat("dd.MM.yyyy - HH:mm", Locale.getDefault()),
formValidators: MutableList<FormValidator<DateTime>> = ArrayList(),
Expand Down Expand Up @@ -81,7 +81,7 @@ class LabelDateTimeElement(private val label: String,
value = dateTime
textView.text = sdf.format(newDate)
positiveValidation()
valueChangeListener.callback(dateTime)
valueChangeListener?.callback(dateTime)
}
textView.setOnClickListener {
DateTimePickerDialog.show(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import cz.qase.android.formbuilderlibrary.validator.FormValidator
class LabelInputElement(private val label: String,
private val hint: String,
private val value: String? = null,
private val valueChangeListener: ValueCallback<String>,
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,
Expand Down Expand Up @@ -60,8 +60,7 @@ class LabelInputElement(private val label: String,
object : TextWatcher {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
positiveValidation()
valueChangeListener.callback(s.toString())

valueChangeListener?.callback(s.toString())
}

override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
Expand Down

0 comments on commit 699eee6

Please sign in to comment.