ui: fix material issues
Migrate dividers over to material theming alongside making detail items use a colorStateList instead of manually indexing for text colors.
This commit is contained in:
@@ -23,7 +23,6 @@ import android.view.ViewGroup
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.oxycblt.auxio.accent.Accent
|
||||
import org.oxycblt.auxio.databinding.ItemAlbumHeaderBinding
|
||||
import org.oxycblt.auxio.databinding.ItemAlbumSongBinding
|
||||
import org.oxycblt.auxio.detail.DetailViewModel
|
||||
@@ -35,7 +34,6 @@ import org.oxycblt.auxio.ui.BaseViewHolder
|
||||
import org.oxycblt.auxio.ui.DiffCallback
|
||||
import org.oxycblt.auxio.util.disable
|
||||
import org.oxycblt.auxio.util.inflater
|
||||
import org.oxycblt.auxio.util.setTextColorResource
|
||||
|
||||
/**
|
||||
* An adapter for displaying the details and [Song]s of an [Album]
|
||||
@@ -48,7 +46,6 @@ class AlbumDetailAdapter(
|
||||
private val doOnClick: (data: Song) -> Unit,
|
||||
private val doOnLongClick: (view: View, data: Song) -> Unit
|
||||
) : ListAdapter<BaseModel, RecyclerView.ViewHolder>(DiffCallback()) {
|
||||
|
||||
private var currentSong: Song? = null
|
||||
private var lastHolder: Highlightable? = null
|
||||
|
||||
@@ -145,9 +142,6 @@ class AlbumDetailAdapter(
|
||||
inner class AlbumSongViewHolder(
|
||||
private val binding: ItemAlbumSongBinding,
|
||||
) : BaseViewHolder<Song>(binding, doOnClick, doOnLongClick), Highlightable {
|
||||
private val normalTextColor = binding.songName.currentTextColor
|
||||
private val inactiveTextColor = binding.songTrack.currentTextColor
|
||||
|
||||
override fun onBind(data: Song) {
|
||||
binding.song = data
|
||||
|
||||
@@ -155,15 +149,8 @@ class AlbumDetailAdapter(
|
||||
}
|
||||
|
||||
override fun setHighlighted(isHighlighted: Boolean) {
|
||||
if (isHighlighted) {
|
||||
val accent = Accent.get()
|
||||
|
||||
binding.songName.setTextColorResource(accent.color)
|
||||
binding.songTrack.setTextColorResource(accent.color)
|
||||
} else {
|
||||
binding.songName.setTextColor(normalTextColor)
|
||||
binding.songTrack.setTextColor(inactiveTextColor)
|
||||
}
|
||||
binding.songName.isActivated = isHighlighted
|
||||
binding.songTrack.isActivated = isHighlighted
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.oxycblt.auxio.accent.Accent
|
||||
import org.oxycblt.auxio.databinding.ItemActionHeaderBinding
|
||||
import org.oxycblt.auxio.databinding.ItemArtistAlbumBinding
|
||||
import org.oxycblt.auxio.databinding.ItemArtistHeaderBinding
|
||||
@@ -38,8 +37,6 @@ import org.oxycblt.auxio.ui.BaseViewHolder
|
||||
import org.oxycblt.auxio.ui.DiffCallback
|
||||
import org.oxycblt.auxio.util.disable
|
||||
import org.oxycblt.auxio.util.inflater
|
||||
import org.oxycblt.auxio.util.logD
|
||||
import org.oxycblt.auxio.util.setTextColorResource
|
||||
|
||||
/**
|
||||
* An adapter for displaying the [Album]s and [Song]s of an artist.
|
||||
@@ -195,8 +192,6 @@ class ArtistDetailAdapter(
|
||||
inner class ArtistAlbumViewHolder(
|
||||
private val binding: ItemArtistAlbumBinding,
|
||||
) : BaseViewHolder<Album>(binding, doOnClick, doOnLongClick), Highlightable {
|
||||
private val normalTextColor = binding.albumName.currentTextColor
|
||||
|
||||
override fun onBind(data: Album) {
|
||||
binding.album = data
|
||||
|
||||
@@ -204,13 +199,7 @@ class ArtistDetailAdapter(
|
||||
}
|
||||
|
||||
override fun setHighlighted(isHighlighted: Boolean) {
|
||||
logD(isHighlighted)
|
||||
|
||||
if (isHighlighted) {
|
||||
binding.albumName.setTextColorResource(Accent.get().color)
|
||||
} else {
|
||||
binding.albumName.setTextColor(normalTextColor)
|
||||
}
|
||||
binding.albumName.isActivated = isHighlighted
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,11 +240,7 @@ class ArtistDetailAdapter(
|
||||
}
|
||||
|
||||
override fun setHighlighted(isHighlighted: Boolean) {
|
||||
if (isHighlighted) {
|
||||
binding.songName.setTextColorResource(Accent.get().color)
|
||||
} else {
|
||||
binding.songName.setTextColor(normalTextColor)
|
||||
}
|
||||
binding.songName.isActivated = isHighlighted
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.view.ViewGroup
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.oxycblt.auxio.accent.Accent
|
||||
import org.oxycblt.auxio.databinding.ItemGenreHeaderBinding
|
||||
import org.oxycblt.auxio.databinding.ItemGenreSongBinding
|
||||
import org.oxycblt.auxio.detail.DetailViewModel
|
||||
@@ -35,7 +34,6 @@ import org.oxycblt.auxio.ui.BaseViewHolder
|
||||
import org.oxycblt.auxio.ui.DiffCallback
|
||||
import org.oxycblt.auxio.util.disable
|
||||
import org.oxycblt.auxio.util.inflater
|
||||
import org.oxycblt.auxio.util.setTextColorResource
|
||||
|
||||
/**
|
||||
* An adapter for displaying the [Song]s of a genre.
|
||||
@@ -48,7 +46,6 @@ class GenreDetailAdapter(
|
||||
private val doOnClick: (data: Song) -> Unit,
|
||||
private val doOnLongClick: (view: View, data: Song) -> Unit
|
||||
) : ListAdapter<BaseModel, RecyclerView.ViewHolder>(DiffCallback()) {
|
||||
|
||||
private var currentSong: Song? = null
|
||||
private var lastHolder: Highlightable? = null
|
||||
|
||||
@@ -145,8 +142,6 @@ class GenreDetailAdapter(
|
||||
inner class GenreSongViewHolder(
|
||||
private val binding: ItemGenreSongBinding,
|
||||
) : BaseViewHolder<Song>(binding, doOnClick, doOnLongClick), Highlightable {
|
||||
private val normalTextColor = binding.songName.currentTextColor
|
||||
|
||||
override fun onBind(data: Song) {
|
||||
binding.song = data
|
||||
|
||||
@@ -155,11 +150,7 @@ class GenreDetailAdapter(
|
||||
}
|
||||
|
||||
override fun setHighlighted(isHighlighted: Boolean) {
|
||||
if (isHighlighted) {
|
||||
binding.songName.setTextColorResource(Accent.get().color)
|
||||
} else {
|
||||
binding.songName.setTextColor(normalTextColor)
|
||||
}
|
||||
binding.songName.isActivated = isHighlighted
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user