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