Add more emphasis to currently playing track in listings.

This commit is contained in:
Antoine POPINEAU 2020-06-26 19:42:10 +02:00
parent 9b888ba17f
commit 49f5754f2b
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
7 changed files with 26 additions and 24 deletions

View File

@ -55,19 +55,14 @@ class FavoritesAdapter(private val context: Context?, private val favoriteListen
holder.title.text = favorite.title holder.title.text = favorite.title
holder.artist.text = favorite.artist.name holder.artist.text = favorite.artist.name
Build.VERSION_CODES.P.onApi( context?.let {
{ holder.itemView.background = context.getDrawable(R.drawable.ripple)
holder.title.setTypeface(holder.title.typeface, Typeface.DEFAULT.weight) }
holder.artist.setTypeface(holder.artist.typeface, Typeface.DEFAULT.weight)
},
{
holder.title.typeface = Typeface.create(holder.title.typeface, Typeface.NORMAL)
holder.artist.typeface = Typeface.create(holder.artist.typeface, Typeface.NORMAL)
})
if (favorite.id == currentTrack?.id) { if (favorite.id == currentTrack?.id) {
holder.title.setTypeface(holder.title.typeface, Typeface.BOLD) context?.let {
holder.artist.setTypeface(holder.artist.typeface, Typeface.BOLD) holder.itemView.background = context.getDrawable(R.drawable.current)
}
} }
context?.let { context?.let {

View File

@ -63,19 +63,14 @@ class TracksAdapter(private val context: Context?, private val favoriteListener:
holder.title.text = track.title holder.title.text = track.title
holder.artist.text = track.artist.name holder.artist.text = track.artist.name
Build.VERSION_CODES.P.onApi( context?.let {
{ holder.itemView.background = context.getDrawable(R.drawable.ripple)
holder.title.setTypeface(holder.title.typeface, Typeface.DEFAULT.weight) }
holder.artist.setTypeface(holder.artist.typeface, Typeface.DEFAULT.weight)
},
{
holder.title.typeface = Typeface.create(holder.title.typeface, Typeface.NORMAL)
holder.artist.typeface = Typeface.create(holder.artist.typeface, Typeface.NORMAL)
})
if (track == currentTrack || track.current) { if (track == currentTrack || track.current) {
holder.title.setTypeface(holder.title.typeface, Typeface.BOLD) context?.let {
holder.artist.setTypeface(holder.artist.typeface, Typeface.BOLD) holder.itemView.background = context.getDrawable(R.drawable.current)
}
} }
context?.let { context?.let {

View File

@ -94,7 +94,10 @@ class FavoritesFragment : FunkwhaleFragment<Track, FavoritesAdapter>() {
private fun refreshCurrentTrack(track: Track?) { private fun refreshCurrentTrack(track: Track?) {
track?.let { track?.let {
adapter.currentTrack = track adapter.currentTrack?.current = false
adapter.currentTrack = track.apply {
current = true
}
adapter.notifyDataSetChanged() adapter.notifyDataSetChanged()
} }
} }

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/current" />
<corners android:radius="4dp" />
</shape>

View File

@ -1,6 +1,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:background="@color/surface"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView

View File

@ -11,12 +11,13 @@
<color name="itemTitle">#abffffff</color> <color name="itemTitle">#abffffff</color>
<color name="controlForeground">#caffffff</color> <color name="controlForeground">#caffffff</color>
<color name="controlColor">#53bce7</color> <color name="controlColor">#77a8c7</color>
<color name="controlAccent">#304A5A</color> <color name="controlAccent">#304A5A</color>
<color name="whiteWhileLight">#000000</color> <color name="whiteWhileLight">#000000</color>
<color name="blackWhileLight">#ffffff</color> <color name="blackWhileLight">#ffffff</color>
<color name="current">#1f2e38</color>
<color name="downloaded">@color/controlColor</color> <color name="downloaded">@color/controlColor</color>
<color name="cached">#aeaeae</color> <color name="cached">#aeaeae</color>

View File

@ -19,6 +19,7 @@
<color name="whiteWhileLight">#ffffff</color> <color name="whiteWhileLight">#ffffff</color>
<color name="blackWhileLight">#000000</color> <color name="blackWhileLight">#000000</color>
<color name="current">#dfecf5</color>
<color name="downloaded">@color/colorPrimary</color> <color name="downloaded">@color/colorPrimary</color>
<color name="cached">#999999</color> <color name="cached">#999999</color>