From f062e622992eff47caf232889a962129d49d7196 Mon Sep 17 00:00:00 2001 From: Antoine POPINEAU Date: Mon, 3 Aug 2020 15:29:48 +0200 Subject: [PATCH] Apply current track style to playlist tracks. --- .../otter/adapters/PlaylistTracksAdapter.kt | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/github/apognu/otter/adapters/PlaylistTracksAdapter.kt b/app/src/main/java/com/github/apognu/otter/adapters/PlaylistTracksAdapter.kt index a5536b9..fdded5b 100644 --- a/app/src/main/java/com/github/apognu/otter/adapters/PlaylistTracksAdapter.kt +++ b/app/src/main/java/com/github/apognu/otter/adapters/PlaylistTracksAdapter.kt @@ -65,19 +65,14 @@ class PlaylistTracksAdapter(private val context: Context?, private val favoriteL holder.title.text = track.track.title holder.artist.text = track.track.artist.name - Build.VERSION_CODES.P.onApi( - { - holder.title.setTypeface(holder.title.typeface, Typeface.DEFAULT.weight) - holder.artist.setTypeface(holder.artist.typeface, Typeface.DEFAULT.weight) - }, - { - holder.title.setTypeface(holder.title.typeface, Typeface.NORMAL) - holder.artist.setTypeface(holder.artist.typeface, Typeface.NORMAL) - }) + context?.let { + holder.itemView.background = context.getDrawable(R.drawable.ripple) + } - if (track.track == currentTrack) { - holder.title.setTypeface(holder.title.typeface, Typeface.BOLD) - holder.artist.setTypeface(holder.artist.typeface, Typeface.BOLD) + if (track.track == currentTrack || track.track.current) { + context?.let { + holder.itemView.background = context.getDrawable(R.drawable.current) + } } context?.let {