Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 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. v?.isSelected = false
  9. v?.clearFocus()
  10. } else {
  11. v?.isSelected = true
  12. v?.requestFocus()
  13. setValue(newValue)
  14. }
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement