Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. private class ClickListener(setValue: (Int) -> (Unit), getValue: () -> (Int)) : View.OnClickListener {
  2.  
  3. override fun onClick(v: View?) {
  4. val oldValue = getValue2()
  5. val newValue = v?.text.toString().toInt()
  6. if (newValue != oldValue) {
  7. if (oldValue != 0)
  8. textViews[oldValue - 1].run {
  9. isSelected = false
  10. clearFocus()
  11. }
  12. v?.isSelected = true
  13. v?.requestFocus()
  14. setValue(newValue)
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement