Merge pull request #1278 from OxygenCobalt/copilot/suppress-unknown-genre-artist-view
Hide genre subhead in artist view when all genres are unknown
This commit is contained in:
@@ -45,6 +45,7 @@ import org.oxycblt.musikr.Artist
|
||||
import org.oxycblt.musikr.Music
|
||||
import org.oxycblt.musikr.MusicParent
|
||||
import org.oxycblt.musikr.Song
|
||||
import org.oxycblt.musikr.tag.Name
|
||||
import timber.log.Timber as L
|
||||
|
||||
/**
|
||||
@@ -147,9 +148,11 @@ class ArtistDetailFragment : DetailFragment<Artist, Music>() {
|
||||
|
||||
if (artist.songs.isNotEmpty()) {
|
||||
// Information about the artist's genre(s) map to the sub-head text
|
||||
binding.detailSubhead.apply {
|
||||
isVisible = true
|
||||
text = artist.genres.resolveNames(context)
|
||||
// Hide the subhead if all genres are unknown (no genre tags in music files)
|
||||
val hasKnownGenres = artist.genres.any { it.name is Name.Known }
|
||||
binding.detailSubhead.isVisible = hasKnownGenres
|
||||
if (hasKnownGenres) {
|
||||
binding.detailSubhead.text = artist.genres.resolveNames(context)
|
||||
}
|
||||
|
||||
// In the case that this header used to he configured to have no songs,
|
||||
|
||||
Reference in New Issue
Block a user