Created
August 13, 2024 10:26
-
-
Save anitaa1990/0121897d6c90181582c9273a08b5524a to your computer and use it in GitHub Desktop.
This file contains 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(holder: ViewHolder, position: Int) { | |
val movie = movies[position] | |
holder.title.text = movie.title | |
holder.rating.text = movie.rating | |
// SRP violation, onBindViewHolder has only the responsibility to display data | |
// & not make data formatting operations | |
val genres = movie.genres | |
val builder = StringBuilder() | |
for (genre in genres) { | |
builder.append(genre).append(",") | |
} | |
holder.genres.text = builder.toString() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment