Skip to content

Instantly share code, notes, and snippets.

@DjakaTechnology
Created March 11, 2019 12:47
Show Gist options
  • Save DjakaTechnology/ae63f148188e9a2894406af12cb556ad to your computer and use it in GitHub Desktop.
Save DjakaTechnology/ae63f148188e9a2894406af12cb556ad to your computer and use it in GitHub Desktop.
v.img_icon.run {
when(data[i].permissionTypeId){
1 -> setImageDrawable(ContextCompat.getDrawable(c, R.drawable.ic_plus))
2 -> setImageDrawable(ContextCompat.getDrawable(c, R.drawable.ic_permission_green))
3 -> setImageDrawable(ContextCompat.getDrawable(c, R.drawable.ic_clock_orange))
}
}
v.tv_status.run{
when(data[i].statusId){
1 -> background.setColorFilter(ContextCompat.getColor(c, R.color.orange_pale), PorterDuff.Mode.SRC_ATOP)
2 -> background.setColorFilter(ContextCompat.getColor(c, R.color.green_pale), PorterDuff.Mode.SRC_ATOP)
3 -> background.setColorFilter(ContextCompat.getColor(c, R.color.red_pale), PorterDuff.Mode.SRC_ATOP)
}
}
v.layout.setOnClickListener {
val i = Intent(c, SubClassAbsentDetailActivity::class.java)
i.putExtra(SharedKey.App.MODEL, data[myViewHolder.adapterPosition])
c.startActivity(i)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment