music: refactor model usage
Refactor the way music models are constructed to achieve the following: - Add a unified interface for resolving display names of artists - Disambiguate the role of Header in the music objects - Eliminate the need to load strings in with a context when creating Header instances
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
android:layout_marginStart="@dimen/spacing_small"
|
||||
android:layout_marginEnd="@dimen/spacing_small"
|
||||
android:ellipsize="end"
|
||||
android:text="@{@string/fmt_two(song.album.artist.name, song.album.name)}"
|
||||
android:text="@{@string/fmt_two(song.album.artist.resolvedName, song.album.name)}"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/playback_cover"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_play_pause"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_cover"
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
android:layout_marginStart="@dimen/spacing_mid_large"
|
||||
android:layout_marginEnd="@dimen/spacing_mid_large"
|
||||
android:onClick="@{() -> detailModel.navToItem(playbackModel.song.album.artist)}"
|
||||
android:text="@{song.album.artist.name}"
|
||||
android:text="@{song.album.artist.resolvedName}"
|
||||
app:layout_constraintBottom_toTopOf="@+id/playback_album"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
style="@style/Widget.Auxio.TextView.Header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{header.name}"
|
||||
android:text="@{header.string.resolve(context)}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
style="@style/Widget.Auxio.TextView.Item.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{@string/fmt_two(album.artist.name, @plurals/fmt_song_count(album.songs.size, album.songs.size))}"
|
||||
android:text="@{@string/fmt_two(album.artist.resolvedName, @plurals/fmt_song_count(album.songs.size, album.songs.size))}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/album_cover"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<ImageView
|
||||
android:id="@+id/artist_image"
|
||||
style="@style/Widget.Auxio.Image.Normal"
|
||||
android:contentDescription="@{@string/desc_artist_image(artist.name)}"
|
||||
android:contentDescription="@{@string/desc_artist_image(artist.resolvedName)}"
|
||||
app:artistImage="@{artist}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -28,7 +28,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.Auxio.TextView.Item.Primary"
|
||||
android:text="@{artist.name}"
|
||||
android:text="@{artist.resolvedName}"
|
||||
app:layout_constraintBottom_toTopOf="@+id/artist_details"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/artist_image"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/album_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.Auxio.TextView.Item.Primary"
|
||||
android:textColor="@color/sel_accented_primary"
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/album_year"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.Auxio.TextView.Item.Secondary"
|
||||
android:text="@{album.year != 0 ? String.valueOf(album.year) : @string/def_date}"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<ImageView
|
||||
android:id="@+id/genre_image"
|
||||
style="@style/Widget.Auxio.Image.Normal"
|
||||
android:contentDescription="@{@string/desc_genre_image(genre.name)}"
|
||||
android:contentDescription="@{@string/desc_genre_image(genre.resolvedName)}"
|
||||
app:genreImage="@{genre}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_medium"
|
||||
android:text="@{@string/fmt_two(song.album.artist.name, song.album.name)}"
|
||||
android:text="@{@string/fmt_two(song.album.artist.resolvedName, song.album.name)}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/song_duration"
|
||||
app:layout_constraintStart_toEndOf="@+id/album_cover"
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.Auxio.TextView.Item.Secondary"
|
||||
android:ellipsize="none"
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
style="@style/Widget.Auxio.TextView.Header"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@{header.name}"
|
||||
android:text="@{header.string.resolve(context)}"
|
||||
tools:text="Songs" />
|
||||
</layout>
|
||||
@@ -69,7 +69,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_medium"
|
||||
android:text="@{@string/fmt_two(song.album.artist.name, song.album.name)}"
|
||||
android:text="@{@string/fmt_two(song.album.artist.resolvedName, song.album.name)}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/song_drag_handle"
|
||||
app:layout_constraintStart_toEndOf="@+id/album_cover"
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
style="@style/Widget.Auxio.TextView.Item.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{@string/fmt_two(song.album.artist.name, song.album.name)}"
|
||||
android:text="@{@string/fmt_two(song.album.artist.resolvedName, song.album.name)}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/album_cover"
|
||||
|
||||
@@ -82,4 +82,4 @@
|
||||
|
||||
</android.widget.LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user