Skip to content

Commit

Permalink
FIX: LabelDateTimeElement fix touch event
Browse files Browse the repository at this point in the history
  • Loading branch information
Zdeněk Balák committed May 3, 2019
1 parent 01fc0f3 commit f630264
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ class LabelDateTimeElement(private val label: String,
} else {
hint
}
textView.setOnTouchListener { _, event ->
when (event.action) {
MotionEvent.ACTION_UP -> {
root.setBackgroundColorResourceId(context, formStyleBundle.secondaryBackgroundColor)
textView.performClick()
}
MotionEvent.ACTION_CANCEL -> {
root.setBackgroundColorResourceId(context, formStyleBundle.secondaryBackgroundColor)
}
MotionEvent.ACTION_DOWN -> {
textView.requestFocus()
root.setBackgroundColorResourceId(context, formStyleBundle.primaryBackgroundColor)
}
}
true
}
val callback: (date: Date) -> Unit = { newDate ->
val dateTime = DateTime(newDate)
value = dateTime
Expand Down

0 comments on commit f630264

Please sign in to comment.