Browse Source

Add more emphasis to currently playing track in listings.

housekeeping/remove-warnings
Antoine POPINEAU 4 years ago
parent
commit
49f5754f2b
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
  1. 17
      app/src/main/java/com/github/apognu/otter/adapters/FavoritesAdapter.kt
  2. 17
      app/src/main/java/com/github/apognu/otter/adapters/TracksAdapter.kt
  3. 5
      app/src/main/java/com/github/apognu/otter/fragments/FavoritesFragment.kt
  4. 6
      app/src/main/res/drawable/current.xml
  5. 1
      app/src/main/res/layout/partial_queue.xml
  6. 3
      app/src/main/res/values-night/colors.xml
  7. 1
      app/src/main/res/values/colors.xml

17
app/src/main/java/com/github/apognu/otter/adapters/FavoritesAdapter.kt

@ -55,19 +55,14 @@ class FavoritesAdapter(private val context: Context?, private val favoriteListen @@ -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 {

17
app/src/main/java/com/github/apognu/otter/adapters/TracksAdapter.kt

@ -63,19 +63,14 @@ class TracksAdapter(private val context: Context?, private val favoriteListener: @@ -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 {

5
app/src/main/java/com/github/apognu/otter/fragments/FavoritesFragment.kt

@ -94,7 +94,10 @@ class FavoritesFragment : FunkwhaleFragment<Track, FavoritesAdapter>() { @@ -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()
}
}

6
app/src/main/res/drawable/current.xml

@ -0,0 +1,6 @@ @@ -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
app/src/main/res/layout/partial_queue.xml

@ -1,6 +1,7 @@ @@ -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

3
app/src/main/res/values-night/colors.xml

@ -11,12 +11,13 @@ @@ -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>

1
app/src/main/res/values/colors.xml

@ -19,6 +19,7 @@ @@ -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…
Cancel
Save