Last active
August 7, 2020 12:50
-
-
Save pflammertsma/56532ee110ffa7fa85f29c48cd8cb426 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 onBindViewHolder(viewHolder: Presenter.ViewHolder, item: Any) { | |
val headerItem = (item as ListRow).headerItem | |
viewHolder.view.apply { | |
(findViewById<View>(R.id.header_icon) as ImageView).apply { | |
val drawableResId = when (headerItem.id) { | |
ID_POPULAR -> R.drawable.ic_popular | |
ID_EDITOR_PICKS -> R.drawable.ic_editor_picks | |
... | |
} | |
setImageDrawable(resources.getDrawable(drawableResId, null)) | |
} | |
(findViewById<View>(R.id.header_label) as TextView).text = headerItem.name | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment