Guest User

Untitled

a guest
Jan 21st, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. class ResourcesHelper {
  2.  
  3. companion object {
  4. val lightBlue = resources.getColor(R.color.lightBlue)
  5. val customBlue = resources.getColor(R.color.customBlue)
  6. // [...]
  7. val fontAwesome = resources.getFont(R.font.fontawesome)
  8. val lemonMilk = resources.getFont(R.font.lemonmilk)
  9. }
  10. }
  11.  
  12. enum class ButtonStyle {
  13. MENU,
  14. // [...]
  15. VICTORY
  16. }
  17.  
  18. class CustomButton(c: Context, attrs: AttributeSet) : Button(c, attrs) {
  19.  
  20. var isButtonActivated = false
  21.  
  22. fun setStyle(style: ButtonStyle) {
  23. setBackgroundColor(ResourcesHelper.transparent)
  24.  
  25. when(style) {
  26. ButtonStyle.MENU -> {
  27. setText(R.string.menu_button)
  28. typeface = ResourcesHelper.lemonMilk
  29. setBackgroundColor(ResourcesHelper.customRed)
  30. setTextColor(ResourcesHelper.white)
  31. }
  32. // [...]
  33. ButtonStyle.VICTORY -> {
  34. setText(R.string.victory_button)
  35. typeface = ResourcesHelper.lemonMilk
  36. setBackgroundColor(ResourcesHelper.customRed)
  37. setTextColor(ResourcesHelper.white)
  38. }
  39. }
  40. }
  41. }
Add Comment
Please, Sign In to add comment