From 98b7812a473c9f66864a2a4386445f167be8bc4e Mon Sep 17 00:00:00 2001 From: Antoine POPINEAU Date: Sat, 16 Nov 2019 16:43:01 +0100 Subject: [PATCH] We failed to remove bold typeface for non-currently playing tracks when recycling views. This is fixed. --- .../com/github/apognu/otter/adapters/FavoritesAdapter.kt | 7 +++---- .../github/apognu/otter/adapters/PlaylistTracksAdapter.kt | 2 +- .../java/com/github/apognu/otter/adapters/TracksAdapter.kt | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/github/apognu/otter/adapters/FavoritesAdapter.kt b/app/src/main/java/com/github/apognu/otter/adapters/FavoritesAdapter.kt index 193a5b7..09031f9 100644 --- a/app/src/main/java/com/github/apognu/otter/adapters/FavoritesAdapter.kt +++ b/app/src/main/java/com/github/apognu/otter/adapters/FavoritesAdapter.kt @@ -59,12 +59,11 @@ class FavoritesAdapter(private val context: Context?, private val favoriteListen 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) + holder.title.typeface = Typeface.create(holder.title.typeface, Typeface.NORMAL) + holder.artist.typeface = Typeface.create(holder.artist.typeface, Typeface.NORMAL) }) - - if (favorite == currentTrack || favorite.current) { + if (favorite.id == currentTrack?.id) { holder.title.setTypeface(holder.title.typeface, Typeface.BOLD) holder.artist.setTypeface(holder.artist.typeface, Typeface.BOLD) } 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 4837794..9a08de6 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 @@ -76,7 +76,7 @@ class PlaylistTracksAdapter(private val context: Context?, private val favoriteL }) - if (track.track == currentTrack || track.track.current) { + if (track.track == currentTrack) { holder.title.setTypeface(holder.title.typeface, Typeface.BOLD) holder.artist.setTypeface(holder.artist.typeface, Typeface.BOLD) } diff --git a/app/src/main/java/com/github/apognu/otter/adapters/TracksAdapter.kt b/app/src/main/java/com/github/apognu/otter/adapters/TracksAdapter.kt index 8e11ece..1759f84 100644 --- a/app/src/main/java/com/github/apognu/otter/adapters/TracksAdapter.kt +++ b/app/src/main/java/com/github/apognu/otter/adapters/TracksAdapter.kt @@ -70,8 +70,8 @@ class TracksAdapter(private val context: Context?, private val favoriteListener: 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) + holder.title.typeface = Typeface.create(holder.title.typeface, Typeface.NORMAL) + holder.artist.typeface = Typeface.create(holder.artist.typeface, Typeface.NORMAL) })