image: disable mosaics for album covers

generally albums dont make sense to have mosaics due to their covers being homogenous most often. so, use the most prominent cover instead.
This commit is contained in:
Alexander Capehart
2025-11-26 14:27:54 -07:00
committed by GitHub
parent 029ddeca61
commit 0f3cddb75e
@@ -326,11 +326,23 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
* *
* @param album The [Album] to bind to the view. * @param album The [Album] to bind to the view.
*/ */
fun bind(album: Album) = fun bind(album: Album) {
// Generally it's not desirable for many albums to show all of their covers since unlike
// artists/genres they don't really change.
// Therefore just pick the most "prominent" cover (the one with the most instances) and load
// that like you would a song instead.
val mostProminentCover =
album.covers.covers
.groupBy { it.id }
.maxByOrNull { it.value.size }
?.value
?.firstOrNull()
bindImpl( bindImpl(
album.covers, mostProminentCover,
context.getString(R.string.desc_album_cover, album.name), context.getString(R.string.desc_album_cover, album.name),
R.drawable.ic_album_24) R.drawable.ic_album_24)
}
/** /**
* Bind an [Artist]'s image to this view. * Bind an [Artist]'s image to this view.