Merge branch 'dev' of github.com:OxygenCobalt/Auxio into dev
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user