Guest User

Untitled

a guest
Apr 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. fun setText(text: String) {
  2. this.text.text = text
  3. }
  4.  
  5. fun setState(state: State) {
  6. when (state) {
  7. State.DISABLED -> {
  8. image.setImageDrawable(resources.getDrawable(R.drawable.ic_more))
  9. image.visibility = View.VISIBLE
  10. progress.visibility = View.GONE
  11. text.setTextColor(resources.getColor(R.color.color_white_transp))
  12. }
  13. State.LOADING -> {
  14. image.visibility = View.GONE
  15. progress.visibility = View.VISIBLE
  16. this.progress.indeterminateDrawable.setColorFilter(resources.getColor(R.color.white), PorterDuff.Mode.MULTIPLY)
  17. text.setTextColor(resources.getColor(R.color.white))
  18. }
  19. State.DONE -> {
  20. image.setImageDrawable(resources.getDrawable(R.drawable.ic_check_white_24dp))
  21. image.visibility = View.VISIBLE
  22. progress.visibility = View.GONE
  23. text.setTextColor(resources.getColor(R.color.white))
  24. }
  25. State.FAILED -> {
  26. image.setImageDrawable(resources.getDrawable(R.drawable.ic_close_red))
  27. image.visibility = View.VISIBLE
  28. progress.visibility = View.GONE
  29. text.setTextColor(resources.getColor(R.color.red_text))
  30. }
  31. }
  32. }
Add Comment
Please, Sign In to add comment