diff --git a/app/src/main/java/org/oxycblt/auxio/image/CoverView.kt b/app/src/main/java/org/oxycblt/auxio/image/CoverView.kt index 53362e0c1..962dc549b 100644 --- a/app/src/main/java/org/oxycblt/auxio/image/CoverView.kt +++ b/app/src/main/java/org/oxycblt/auxio/image/CoverView.kt @@ -326,11 +326,23 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr * * @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( - album.covers, + mostProminentCover, context.getString(R.string.desc_album_cover, album.name), R.drawable.ic_album_24) + } /** * Bind an [Artist]'s image to this view.