show the album artist at the header too

This commit is contained in:
tibbi 2020-10-05 19:22:30 +02:00
parent e5532a2d7e
commit 7ccaa76026
4 changed files with 29 additions and 8 deletions

View file

@ -27,7 +27,7 @@ class SongsActivity : SimpleActivity() {
getSongs(album.id) { songs ->
val items = ArrayList<ListItem>()
val coverArt = ContentUris.withAppendedId(artworkUri, album.id.toLong()).toString()
val header = AlbumHeader(album.title, coverArt, album.year, songs.size, songs.sumBy { it.duration })
val header = AlbumHeader(album.title, coverArt, album.year, songs.size, songs.sumBy { it.duration }, album.artist)
items.add(header)
items.addAll(songs)

View file

@ -99,7 +99,7 @@ class SongsAdapter(activity: SimpleActivity, val items: ArrayList<ListItem>, rec
private fun setupHeader(view: View, header: AlbumHeader) {
view.apply {
album_title.text = header.title
album_title.setTextColor(textColor)
album_artist.text = header.artist
val tracks = resources.getQuantityString(R.plurals.tracks, header.songCnt, header.songCnt)
var year = ""
@ -109,6 +109,10 @@ class SongsAdapter(activity: SimpleActivity, val items: ArrayList<ListItem>, rec
album_meta.text = "$year$tracks${header.duration.getFormattedDuration(true)}"
arrayOf(album_title, album_artist, album_meta).forEach {
it.setTextColor(textColor)
}
val options = RequestOptions()
.error(placeholder)
.transform(CenterCrop(), RoundedCorners(16))

View file

@ -1,3 +1,3 @@
package com.simplemobiletools.musicplayer.models
data class AlbumHeader(val title: String, val coverArt: String, val year: Int, val songCnt: Int, val duration: Int) : ListItem()
data class AlbumHeader(val title: String, val coverArt: String, val year: Int, val songCnt: Int, val duration: Int, val artist: String) : ListItem()

View file

@ -24,12 +24,29 @@
android:paddingStart="@dimen/normal_margin"
android:paddingEnd="@dimen/medium_margin"
android:textSize="@dimen/big_text_size"
app:layout_constraintBottom_toTopOf="@+id/album_artist"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/album_image"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Album Title" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/album_artist"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/medium_margin"
android:alpha="0.8"
android:ellipsize="end"
android:maxLines="2"
android:paddingStart="@dimen/normal_margin"
android:paddingEnd="@dimen/medium_margin"
android:textSize="@dimen/bigger_text_size"
app:layout_constraintBottom_toTopOf="@+id/album_meta"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/album_image"
app:layout_constraintTop_toTopOf="@+id/album_image"
app:layout_constraintVertical_chainStyle="packed"
tools:text="2019 • 3 Tracks • 0:35:40" />
app:layout_constraintTop_toBottomOf="@+id/album_title"
tools:text="Album Artist" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/album_meta"
@ -41,10 +58,10 @@
android:paddingStart="@dimen/normal_margin"
android:paddingEnd="@dimen/medium_margin"
android:textSize="@dimen/normal_text_size"
app:layout_constraintBottom_toBottomOf="@+id/album_image"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/album_image"
app:layout_constraintTop_toBottomOf="@+id/album_title"
app:layout_constraintTop_toBottomOf="@+id/album_artist"
tools:text="2019 • 3 Tracks • 0:39:25" />
</androidx.constraintlayout.widget.ConstraintLayout>