Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TaskViewHolder(v: View) : RecyclerView.ViewHolder(v), View.OnClickListener
- {
- var mId: TextView = v.task_id
- var mDescription: TextView = v.task_description
- var mCard: CardView = v.task_card
- var mView: View = v
- }
- override fun onBindViewHolder(holder: TaskViewHolder, position: Int)
- {
- // Initialize ViewHolder content
- holder.mId.text = items[position].getID().toString()
- holder.mDescription.text = items[position].getDescription()
- holder.mTask = items[position]
- for (elem in priorities)
- {
- if (elem.getID() == items[position].getPriority())
- {
- holder.mCard.setCardBackgroundColor(Color.parseColor("#c2c2c2"))
- break
- }
- }
- }
- holder.mCard.setCardBackgroundColor(ContextCompat.getColor(holder.mView.context, R.color.priority3))
- if (elem.getID() == items[position].getPriority())
- {
- holder.mCard.setCardBackgroundColor(ContextCompat.getColor(mContext, [first color]))
- } else {
- holder.mCard.setCardBackgroundColor(ContextCompat.getColor(mContext,[second color]))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement