Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. class TaskViewHolder(v: View) : RecyclerView.ViewHolder(v), View.OnClickListener
  2. {
  3. var mId: TextView = v.task_id
  4. var mDescription: TextView = v.task_description
  5. var mCard: CardView = v.task_card
  6. var mView: View = v
  7. }
  8.  
  9. override fun onBindViewHolder(holder: TaskViewHolder, position: Int)
  10. {
  11. // Initialize ViewHolder content
  12. holder.mId.text = items[position].getID().toString()
  13. holder.mDescription.text = items[position].getDescription()
  14. holder.mTask = items[position]
  15.  
  16. for (elem in priorities)
  17. {
  18. if (elem.getID() == items[position].getPriority())
  19. {
  20. holder.mCard.setCardBackgroundColor(Color.parseColor("#c2c2c2"))
  21. break
  22. }
  23. }
  24. }
  25.  
  26. holder.mCard.setCardBackgroundColor(ContextCompat.getColor(holder.mView.context, R.color.priority3))
  27.  
  28. if (elem.getID() == items[position].getPriority())
  29. {
  30. holder.mCard.setCardBackgroundColor(ContextCompat.getColor(mContext, [first color]))
  31. } else {
  32. holder.mCard.setCardBackgroundColor(ContextCompat.getColor(mContext,[second color]))
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement