detail: show list of artists in genre UI

Show a list of artists that contain songs from a particular genre in
the genre UI.

This used to be in really early Auxio versions, but was intertwined
with some really stupid genre functionality that would include songs
from an entire artist for some reason. Since now albums can be shown
in several artist entires, it makes no sense now what artists can't
be given the same treatment.
This commit is contained in:
Alexander Capehart 2022-11-13 18:42:11 -07:00
parent 459e71b941
commit 3a236bdaf4
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
4 changed files with 10 additions and 0 deletions

View file

@ -11,6 +11,7 @@
- Upgraded music ID management: - Upgraded music ID management:
- Added support for MusicBrainz IDs (MBIDs) - Added support for MusicBrainz IDs (MBIDs)
- Use the more unique MD5 hash of metadata when MBIDs can't be used - Use the more unique MD5 hash of metadata when MBIDs can't be used
- Genres now display a list of artists
- Added toggle to load non-music (Such as podcasts) - Added toggle to load non-music (Such as podcasts)
- Music loader now caches parsed metadata for faster load times - Music loader now caches parsed metadata for faster load times
- Redesigned icon - Redesigned icon

View file

@ -277,6 +277,8 @@ class DetailViewModel(application: Application) :
private fun refreshGenreData(genre: Genre) { private fun refreshGenreData(genre: Genre) {
logD("Refreshing genre data") logD("Refreshing genre data")
val data = mutableListOf<Item>(genre) val data = mutableListOf<Item>(genre)
data.add(Header(R.string.lbl_artists))
data.addAll(genre.artists)
data.add(SortHeader(R.string.lbl_songs)) data.add(SortHeader(R.string.lbl_songs))
data.addAll(genreSort.songs(genre.songs)) data.addAll(genreSort.songs(genre.songs))
_genreData.value = data _genreData.value = data

View file

@ -35,6 +35,7 @@ import org.oxycblt.auxio.ui.recycler.MenuItemListener
import org.oxycblt.auxio.ui.recycler.SimpleItemCallback import org.oxycblt.auxio.ui.recycler.SimpleItemCallback
import org.oxycblt.auxio.util.context import org.oxycblt.auxio.util.context
import org.oxycblt.auxio.util.inflater import org.oxycblt.auxio.util.inflater
import org.oxycblt.auxio.util.logD
abstract class DetailAdapter<L : DetailAdapter.Listener>( abstract class DetailAdapter<L : DetailAdapter.Listener>(
private val listener: L, private val listener: L,

View file

@ -24,9 +24,12 @@ import androidx.recyclerview.widget.RecyclerView
import org.oxycblt.auxio.IntegerTable import org.oxycblt.auxio.IntegerTable
import org.oxycblt.auxio.R import org.oxycblt.auxio.R
import org.oxycblt.auxio.databinding.ItemDetailBinding import org.oxycblt.auxio.databinding.ItemDetailBinding
import org.oxycblt.auxio.music.Artist
import org.oxycblt.auxio.music.Genre import org.oxycblt.auxio.music.Genre
import org.oxycblt.auxio.music.Song import org.oxycblt.auxio.music.Song
import org.oxycblt.auxio.playback.formatDurationMs import org.oxycblt.auxio.playback.formatDurationMs
import org.oxycblt.auxio.ui.recycler.ArtistViewHolder
import org.oxycblt.auxio.ui.recycler.Header
import org.oxycblt.auxio.ui.recycler.Item import org.oxycblt.auxio.ui.recycler.Item
import org.oxycblt.auxio.ui.recycler.SimpleItemCallback import org.oxycblt.auxio.ui.recycler.SimpleItemCallback
import org.oxycblt.auxio.ui.recycler.SongViewHolder import org.oxycblt.auxio.ui.recycler.SongViewHolder
@ -43,6 +46,7 @@ class GenreDetailAdapter(private val listener: Listener) :
override fun getItemViewType(position: Int) = override fun getItemViewType(position: Int) =
when (differ.currentList[position]) { when (differ.currentList[position]) {
is Genre -> GenreDetailViewHolder.VIEW_TYPE is Genre -> GenreDetailViewHolder.VIEW_TYPE
is Artist -> ArtistViewHolder.VIEW_TYPE
is Song -> SongViewHolder.VIEW_TYPE is Song -> SongViewHolder.VIEW_TYPE
else -> super.getItemViewType(position) else -> super.getItemViewType(position)
} }
@ -50,6 +54,7 @@ class GenreDetailAdapter(private val listener: Listener) :
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
when (viewType) { when (viewType) {
GenreDetailViewHolder.VIEW_TYPE -> GenreDetailViewHolder.new(parent) GenreDetailViewHolder.VIEW_TYPE -> GenreDetailViewHolder.new(parent)
ArtistViewHolder.VIEW_TYPE -> ArtistViewHolder.new(parent)
SongViewHolder.VIEW_TYPE -> SongViewHolder.new(parent) SongViewHolder.VIEW_TYPE -> SongViewHolder.new(parent)
else -> super.onCreateViewHolder(parent, viewType) else -> super.onCreateViewHolder(parent, viewType)
} }
@ -64,6 +69,7 @@ class GenreDetailAdapter(private val listener: Listener) :
if (payloads.isEmpty()) { if (payloads.isEmpty()) {
when (val item = differ.currentList[position]) { when (val item = differ.currentList[position]) {
is Genre -> (holder as GenreDetailViewHolder).bind(item, listener) is Genre -> (holder as GenreDetailViewHolder).bind(item, listener)
is Artist -> (holder as ArtistViewHolder).bind(item, listener)
is Song -> (holder as SongViewHolder).bind(item, listener) is Song -> (holder as SongViewHolder).bind(item, listener)
} }
} }