mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 15:29:15 +01:00
ui: localize the empty artist bio
This commit is contained in:
@@ -133,7 +133,6 @@ private val SHUFFLE_HANG = SHUFFLE_HEIGHT / 2
|
|||||||
private val BIO_ACTION_RESERVE = 104.dp
|
private val BIO_ACTION_RESERVE = 104.dp
|
||||||
private val BIO_ACTION_HEIGHT = 48.dp
|
private val BIO_ACTION_HEIGHT = 48.dp
|
||||||
private val BIO_TOP_GAP = 8.dp
|
private val BIO_TOP_GAP = 8.dp
|
||||||
private const val ARTIST_BIO_EMPTY = "No artist bio available."
|
|
||||||
|
|
||||||
internal fun estimateScrollPx(
|
internal fun estimateScrollPx(
|
||||||
index: Int,
|
index: Int,
|
||||||
@@ -267,11 +266,12 @@ fun ArtistDetailScreen(
|
|||||||
)
|
)
|
||||||
val albumCountText = pluralStringResource(R.plurals.resources_album_count, albumCount.toInt(), albumCount)
|
val albumCountText = pluralStringResource(R.plurals.resources_album_count, albumCount.toInt(), albumCount)
|
||||||
val metaText = if (albumsLoaded) stringResource(R.string.artist_meta, artistType, albumCountText) else ""
|
val metaText = if (albumsLoaded) stringResource(R.string.artist_meta, artistType, albumCountText) else ""
|
||||||
// No server biography is mirrored yet, so the page ships with the empty state. The collapsed
|
// No server biography is mirrored yet, so the page ships with the empty state. When the bio is
|
||||||
// and expanded paths below are ready for it: collapsed keeps two lines and ends with a bold
|
// wired, set bioIsEmpty and bioText from it and use bioCollapsed for the two-line preview; the
|
||||||
// More, expanded shows the full flow and leaves extra room before the first section.
|
// collapsed line ends with a bold More that should expand the block.
|
||||||
val bioCollapsed = true
|
val bioCollapsed = true
|
||||||
val bioText = ARTIST_BIO_EMPTY
|
val bioIsEmpty = true
|
||||||
|
val bioText = stringResource(R.string.artist_bio_empty)
|
||||||
var titleHeightPx by remember { mutableFloatStateOf(0f) }
|
var titleHeightPx by remember { mutableFloatStateOf(0f) }
|
||||||
val titleHeight = if (titleHeightPx > 0f) with(density) { titleHeightPx.toDp() } else lineHeight
|
val titleHeight = if (titleHeightPx > 0f) with(density) { titleHeightPx.toDp() } else lineHeight
|
||||||
val titleMaxLines =
|
val titleMaxLines =
|
||||||
@@ -412,7 +412,7 @@ fun ArtistDetailScreen(
|
|||||||
ArtistBio(
|
ArtistBio(
|
||||||
text = bioText,
|
text = bioText,
|
||||||
color =
|
color =
|
||||||
if (bioText == ARTIST_BIO_EMPTY) {
|
if (bioIsEmpty) {
|
||||||
MaterialTheme.colorScheme.outline
|
MaterialTheme.colorScheme.outline
|
||||||
} else {
|
} else {
|
||||||
MaterialTheme.colorScheme.onSurfaceVariant
|
MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
@@ -424,7 +424,7 @@ fun ArtistDetailScreen(
|
|||||||
onMore = onMore,
|
onMore = onMore,
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.padding(
|
Modifier.padding(
|
||||||
bottom = if (!bioCollapsed && bioText != ARTIST_BIO_EMPTY) 8.dp else 0.dp,
|
bottom = if (!bioCollapsed && !bioIsEmpty) 8.dp else 0.dp,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
<string name="artist_type_album_artist">Album artist</string>
|
<string name="artist_type_album_artist">Album artist</string>
|
||||||
<string name="artist_section_albums">Albums</string>
|
<string name="artist_section_albums">Albums</string>
|
||||||
<string name="artist_section_appearances">Appears on</string>
|
<string name="artist_section_appearances">Appears on</string>
|
||||||
|
<string name="artist_bio_empty">No artist bio available.</string>
|
||||||
<string name="artist_meta">%1$s · %2$s</string>
|
<string name="artist_meta">%1$s · %2$s</string>
|
||||||
<string name="resources_filter_genre">Genre</string>
|
<string name="resources_filter_genre">Genre</string>
|
||||||
<string name="resources_filter_starred">Starred</string>
|
<string name="resources_filter_starred">Starred</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user