detail: add item type

Add an item type indicator to the top of the detail header.

This is primarily for release type functionality, but also makes it
more clear the item one is looking at.
This commit is contained in:
OxygenCobalt
2022-08-06 14:53:06 -06:00
parent 7b3490d5d3
commit 0cef51fa97
11 changed files with 89 additions and 32 deletions
@@ -115,6 +115,9 @@ private class AlbumDetailViewHolder private constructor(private val binding: Ite
override fun bind(item: Album, listener: AlbumDetailAdapter.Listener) {
binding.detailCover.bind(item)
binding.detailType?.text =
binding.context.getString(item.releaseType?.stringRes ?: R.string.lbl_album)
binding.detailName.text = item.resolveName(binding.context)
binding.detailSubhead.apply {
@@ -131,17 +134,7 @@ private class AlbumDetailViewHolder private constructor(private val binding: Ite
val duration = item.durationSecs.formatDuration(true)
text =
if (item.releaseType != null) {
context.getString(
R.string.fmt_four,
context.getString(item.releaseType.stringRes),
date,
songCount,
duration)
} else {
context.getString(R.string.fmt_three, date, songCount, duration)
}
text = context.getString(R.string.fmt_three, date, songCount, duration)
}
binding.detailPlayButton.setOnClickListener { listener.onPlayParent() }
@@ -123,6 +123,7 @@ private class ArtistDetailViewHolder private constructor(private val binding: It
override fun bind(item: Artist, listener: DetailAdapter.Listener) {
binding.detailCover.bind(item)
binding.detailType?.text = binding.context.getString(R.string.lbl_artist)
binding.detailName.text = item.resolveName(binding.context)
// Get the genre that corresponds to the most songs in this artist, which would be
@@ -104,6 +104,7 @@ private class GenreDetailViewHolder private constructor(private val binding: Ite
BindingViewHolder<Genre, DetailAdapter.Listener>(binding.root) {
override fun bind(item: Genre, listener: DetailAdapter.Listener) {
binding.detailCover.bind(item)
binding.detailType?.text = binding.context.getString(R.string.lbl_genre)
binding.detailName.text = item.resolveName(binding.context)
binding.detailSubhead.text =
binding.context.getPlural(R.plurals.fmt_song_count, item.songs.size)