Add more emphasis to currently playing track in listings.
This commit is contained in:
parent
9b888ba17f
commit
49f5754f2b
|
@ -55,19 +55,14 @@ class FavoritesAdapter(private val context: Context?, private val favoriteListen
|
|||
holder.title.text = favorite.title
|
||||
holder.artist.text = favorite.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.typeface = Typeface.create(holder.title.typeface, Typeface.NORMAL)
|
||||
holder.artist.typeface = Typeface.create(holder.artist.typeface, Typeface.NORMAL)
|
||||
})
|
||||
context?.let {
|
||||
holder.itemView.background = context.getDrawable(R.drawable.ripple)
|
||||
}
|
||||
|
||||
if (favorite.id == currentTrack?.id) {
|
||||
holder.title.setTypeface(holder.title.typeface, Typeface.BOLD)
|
||||
holder.artist.setTypeface(holder.artist.typeface, Typeface.BOLD)
|
||||
context?.let {
|
||||
holder.itemView.background = context.getDrawable(R.drawable.current)
|
||||
}
|
||||
}
|
||||
|
||||
context?.let {
|
||||
|
|
|
@ -63,19 +63,14 @@ class TracksAdapter(private val context: Context?, private val favoriteListener:
|
|||
holder.title.text = track.title
|
||||
holder.artist.text = 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.typeface = Typeface.create(holder.title.typeface, Typeface.NORMAL)
|
||||
holder.artist.typeface = Typeface.create(holder.artist.typeface, Typeface.NORMAL)
|
||||
})
|
||||
context?.let {
|
||||
holder.itemView.background = context.getDrawable(R.drawable.ripple)
|
||||
}
|
||||
|
||||
if (track == currentTrack || track.current) {
|
||||
holder.title.setTypeface(holder.title.typeface, Typeface.BOLD)
|
||||
holder.artist.setTypeface(holder.artist.typeface, Typeface.BOLD)
|
||||
context?.let {
|
||||
holder.itemView.background = context.getDrawable(R.drawable.current)
|
||||
}
|
||||
}
|
||||
|
||||
context?.let {
|
||||
|
|
|
@ -94,7 +94,10 @@ class FavoritesFragment : FunkwhaleFragment<Track, FavoritesAdapter>() {
|
|||
|
||||
private fun refreshCurrentTrack(track: Track?) {
|
||||
track?.let {
|
||||
adapter.currentTrack = track
|
||||
adapter.currentTrack?.current = false
|
||||
adapter.currentTrack = track.apply {
|
||||
current = true
|
||||
}
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -1,6 +1,7 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/surface"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
|
|
@ -11,12 +11,13 @@
|
|||
<color name="itemTitle">#abffffff</color>
|
||||
|
||||
<color name="controlForeground">#caffffff</color>
|
||||
<color name="controlColor">#53bce7</color>
|
||||
<color name="controlColor">#77a8c7</color>
|
||||
<color name="controlAccent">#304A5A</color>
|
||||
|
||||
<color name="whiteWhileLight">#000000</color>
|
||||
<color name="blackWhileLight">#ffffff</color>
|
||||
|
||||
<color name="current">#1f2e38</color>
|
||||
<color name="downloaded">@color/controlColor</color>
|
||||
<color name="cached">#aeaeae</color>
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<color name="whiteWhileLight">#ffffff</color>
|
||||
<color name="blackWhileLight">#000000</color>
|
||||
|
||||
<color name="current">#dfecf5</color>
|
||||
<color name="downloaded">@color/colorPrimary</color>
|
||||
<color name="cached">#999999</color>
|
||||
|
||||
|
|
Loading…
Reference in New Issue