Add cover art to album list item
Add cover art to the album list item.
This commit is contained in:
parent
acef9550fa
commit
5662725c72
5 changed files with 32 additions and 3 deletions
|
|
@ -11,6 +11,11 @@ class AlbumViewHolder(
|
|||
// Bind the view w/new data
|
||||
fun bind(album: Album) {
|
||||
binding.album = album
|
||||
|
||||
// Set an album cover [If possible]
|
||||
album.cover?.let { cover ->
|
||||
binding.cover.setImageBitmap(cover)
|
||||
}
|
||||
binding.executePendingBindings()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,15 +12,32 @@
|
|||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/margin_medium">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cover"
|
||||
android:layout_width="@dimen/cover_size"
|
||||
android:layout_height="@dimen/cover_size"
|
||||
android:contentDescription="@{@string/description_cover_art + album.title}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@tools:sample/backgrounds/scenic" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/albumNameText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{album.title}"
|
||||
android:textAppearance="?attr/textAppearanceListItem"
|
||||
android:layout_marginStart="@dimen/margin_medium"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.05"
|
||||
app:layout_constraintStart_toEndOf="@+id/cover"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Album Name" />
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="padding_small">4dp</dimen>
|
||||
<dimen name="padding_medium">8dp</dimen>
|
||||
|
||||
<dimen name="margin_medium">8dp</dimen>
|
||||
|
||||
<dimen name="cover_size">64dp</dimen>
|
||||
|
||||
<dimen name="elevation_normal">6dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -8,4 +8,6 @@
|
|||
<string name="label_retry">Retry</string>
|
||||
|
||||
<string name="title_library_fragment">Library</string>
|
||||
|
||||
<string name="description_cover_art">Cover art for </string>
|
||||
</resources>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<resources>
|
||||
<!-- Base theme -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||
<!-- Make this accent settable -->
|
||||
<!-- TODO: Make this accent settable -->
|
||||
<item name="colorAccent">#295DE5</item>
|
||||
</style>
|
||||
</resources>
|
||||
Loading…
Reference in a new issue