Created
October 22, 2018 16:32
-
-
Save myeonginwoo/0a645eee77cf06fb9e99bc130b2404a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override fun onUpdatedItem(oldItem: Item, newItem: Item) { | |
| tv_item.text = "${getItemStr(oldItem)} -> ${getItemStr(newItem)}" | |
| iv_item.setBackgroundColor(ContextCompat.getColor(this, when (newItem) { | |
| ITEM_A -> R.color.red | |
| ITEM_B -> R.color.green | |
| ITEM_C -> R.color.blue | |
| })) | |
| } | |
| private fun getItemStr(item: Item): String = getString(when (item) { | |
| ITEM_A -> R.string.a | |
| ITEM_B -> R.string.b | |
| ITEM_C -> R.string.c | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment