mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
Revert "ui: show the singular and plural artist rows separately"
This reverts commit 2f95a89682.
This commit is contained in:
@@ -9,14 +9,6 @@ internal fun Song.artistSubtitle(): String? = artistSubtitle(artist, artists)
|
||||
|
||||
internal fun Song.artistNames(): List<String> = artistNames(artist, artists)
|
||||
|
||||
internal fun Song.artistList(): String? =
|
||||
artists
|
||||
.map { it.name }
|
||||
.filter { it.isNotBlank() }
|
||||
.distinct()
|
||||
.joinToString(ARTIST_SEPARATOR)
|
||||
.takeIf { it.isNotEmpty() }
|
||||
|
||||
internal fun artistNames(
|
||||
artist: String?,
|
||||
artists: List<ArtistRef>,
|
||||
|
||||
@@ -46,13 +46,20 @@ fun SongInfoDialog(
|
||||
title = { Text(stringResource(R.string.info)) },
|
||||
text = {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
val artist = song.artist?.takeIf { it.isNotBlank() }
|
||||
val regularArtistSort = artist ?: song.artists.firstOrNull()?.name
|
||||
val multipleArtists = song.artistNames().size > 1
|
||||
val regularArtistSort = song.artist?.takeIf { it.isNotBlank() } ?: song.artistRefs.firstOrNull()?.name
|
||||
InfoRow(stringResource(R.string.resources_sort_by_title), song.title)
|
||||
InfoRow(stringResource(R.string.info_sort_title), song.sortName.takeIfDifferentFrom(song.title))
|
||||
InfoRow(stringResource(R.string.resources_filter_artist), artist)
|
||||
InfoRow(stringResource(R.string.info_artists), song.artistList().takeIfDifferentFrom(artist))
|
||||
InfoRow(stringResource(R.string.info_artist_sort), song.artistSort.takeIfDifferentFrom(regularArtistSort))
|
||||
InfoRow(
|
||||
stringResource(
|
||||
if (multipleArtists) R.string.info_artists else R.string.resources_filter_artist,
|
||||
),
|
||||
song.artistSubtitle(),
|
||||
)
|
||||
InfoRow(
|
||||
stringResource(if (multipleArtists) R.string.info_artists_sort else R.string.info_artist_sort),
|
||||
song.artistSort.takeIfDifferentFrom(regularArtistSort),
|
||||
)
|
||||
InfoRow(stringResource(R.string.resources_filter_album), song.album)
|
||||
InfoRow(stringResource(R.string.info_duration), song.duration?.let(DateUtils::formatElapsedTime))
|
||||
InfoRow(
|
||||
|
||||
@@ -198,6 +198,7 @@
|
||||
<string name="info_channels">Channels</string>
|
||||
<string name="info_close">Close</string>
|
||||
<string name="info_artists">Artists</string>
|
||||
<string name="info_artists_sort">Artists sort</string>
|
||||
<string name="info_album_artists">Album artists</string>
|
||||
<string name="info_album_artist_sort">Album artist sort</string>
|
||||
<string name="info_sort_title">Sort title</string>
|
||||
|
||||
@@ -215,7 +215,7 @@ class LibraryInfoDialogTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aSingleArtistTrackHidesTheDuplicateArtistsRow() {
|
||||
fun aSingleArtistTrackUsesSingularLabels() {
|
||||
composeRule.setContent {
|
||||
SubtracksTheme {
|
||||
SongInfoDialog(
|
||||
@@ -236,7 +236,7 @@ class LibraryInfoDialogTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun duplicateAndBlankArtistRefsDoNotAddAnArtistsRow() {
|
||||
fun duplicateAndBlankArtistRefsStaySingular() {
|
||||
composeRule.setContent {
|
||||
SubtracksTheme {
|
||||
SongInfoDialog(
|
||||
@@ -259,7 +259,7 @@ class LibraryInfoDialogTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aMixedArtistTrackShowsBothTheArtistAndArtistsRows() {
|
||||
fun aMixedArtistTrackUsesPluralLabelsForBothRows() {
|
||||
composeRule.setContent {
|
||||
SubtracksTheme {
|
||||
SongInfoDialog(
|
||||
@@ -277,12 +277,10 @@ class LibraryInfoDialogTest {
|
||||
}
|
||||
}
|
||||
|
||||
composeRule.onNodeWithText("Artist").assertIsDisplayed()
|
||||
composeRule.onNodeWithText("Artists").assertIsDisplayed()
|
||||
composeRule.onNodeWithText("Artist A").assertIsDisplayed()
|
||||
composeRule.onNodeWithText("Artist A · Artist B").assertIsDisplayed()
|
||||
composeRule.onNodeWithText("Artist sort").assertIsDisplayed()
|
||||
composeRule.onNodeWithText("Artists sort").assertDoesNotExist()
|
||||
composeRule.onNodeWithText("Artists sort").assertIsDisplayed()
|
||||
composeRule.onNodeWithText("Artist").assertDoesNotExist()
|
||||
composeRule.onNodeWithText("Artist sort").assertDoesNotExist()
|
||||
composeRule.onNodeWithText("Alpha").assertIsDisplayed()
|
||||
}
|
||||
|
||||
@@ -306,7 +304,7 @@ class LibraryInfoDialogTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aMixedArtistTrackWithoutASortStillShowsBothArtistRows() {
|
||||
fun aMixedArtistTrackWithoutASortShowsOnlyTheArtistsRow() {
|
||||
composeRule.setContent {
|
||||
SubtracksTheme {
|
||||
SongInfoDialog(
|
||||
@@ -324,11 +322,9 @@ class LibraryInfoDialogTest {
|
||||
}
|
||||
}
|
||||
|
||||
composeRule.onNodeWithText("Artist").assertIsDisplayed()
|
||||
composeRule.onNodeWithText("Artists").assertIsDisplayed()
|
||||
composeRule.onNodeWithText("Artist A").assertIsDisplayed()
|
||||
composeRule.onNodeWithText("Artist A · Artist B").assertIsDisplayed()
|
||||
composeRule.onNodeWithText("Artist sort").assertDoesNotExist()
|
||||
composeRule.onNodeWithText("Artists sort").assertDoesNotExist()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -48,7 +48,7 @@ class SongArtistDisplayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theInfoDialogShowsTheSingularArtistAndThePluralArtistsSeparately() {
|
||||
fun theInfoDialogListsThePluralArtistsWithTheSingularArtistFirst() {
|
||||
composeRule.setContent {
|
||||
SubtracksTheme {
|
||||
SongInfoDialog(
|
||||
@@ -62,7 +62,6 @@ class SongArtistDisplayTest {
|
||||
}
|
||||
}
|
||||
|
||||
composeRule.onNodeWithText("Two").assertIsDisplayed()
|
||||
composeRule.onNodeWithText("One · Two · Three").assertIsDisplayed()
|
||||
composeRule.onNodeWithText("Two · One · Three").assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user