Add icons for author and artist in MangaInfoHeader (#10079)

* Mark author and artist

* overall style

* Clean up spacing

---------

Co-authored-by: arkon <eugcheung94@gmail.com>
This commit is contained in:
Eshlender 2023-10-29 00:46:10 +05:00 committed by GitHub
parent d80ba2e807
commit 7457a18aee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,8 +24,10 @@ import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Brush
import androidx.compose.material.icons.filled.Favorite import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.HourglassEmpty import androidx.compose.material.icons.filled.HourglassEmpty
import androidx.compose.material.icons.filled.PersonOutline
import androidx.compose.material.icons.filled.Warning import androidx.compose.material.icons.filled.Warning
import androidx.compose.material.icons.outlined.AttachMoney import androidx.compose.material.icons.outlined.AttachMoney
import androidx.compose.material.icons.outlined.Block import androidx.compose.material.icons.outlined.Block
@ -459,6 +461,7 @@ private fun MangaAndSourceTitlesSmall(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(start = 16.dp, top = appBarPadding + 16.dp, end = 16.dp), .padding(start = 16.dp, top = appBarPadding + 16.dp, end = 16.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
MangaCover.Book( MangaCover.Book(
@ -469,7 +472,9 @@ private fun MangaAndSourceTitlesSmall(
contentDescription = stringResource(R.string.manga_cover), contentDescription = stringResource(R.string.manga_cover),
onClick = onCoverClick, onClick = onCoverClick,
) )
Column(modifier = Modifier.padding(start = 16.dp)) { Column(
verticalArrangement = Arrangement.spacedBy(2.dp),
) {
Text( Text(
text = title.ifBlank { stringResource(R.string.unknown_title) }, text = title.ifBlank { stringResource(R.string.unknown_title) },
style = MaterialTheme.typography.titleLarge, style = MaterialTheme.typography.titleLarge,
@ -485,14 +490,24 @@ private fun MangaAndSourceTitlesSmall(
onClick = { if (title.isNotBlank()) doSearch(title, true) }, onClick = { if (title.isNotBlank()) doSearch(title, true) },
), ),
) )
Spacer(modifier = Modifier.height(2.dp)) Spacer(modifier = Modifier.height(2.dp))
Row(
modifier = Modifier.secondaryItemAlpha(),
horizontalArrangement = Arrangement.spacedBy(4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
imageVector = Icons.Filled.PersonOutline,
contentDescription = null,
modifier = Modifier.size(16.dp),
)
Text( Text(
text = author?.takeIf { it.isNotBlank() } text = author?.takeIf { it.isNotBlank() }
?: stringResource(R.string.unknown_author), ?: stringResource(R.string.unknown_author),
style = MaterialTheme.typography.titleSmall, style = MaterialTheme.typography.titleSmall,
modifier = Modifier modifier = Modifier
.secondaryItemAlpha()
.padding(top = 2.dp)
.clickableNoIndication( .clickableNoIndication(
onLongClick = { onLongClick = {
if (!author.isNullOrBlank()) { if (!author.isNullOrBlank()) {
@ -505,20 +520,33 @@ private fun MangaAndSourceTitlesSmall(
onClick = { if (!author.isNullOrBlank()) doSearch(author, true) }, onClick = { if (!author.isNullOrBlank()) doSearch(author, true) },
), ),
) )
}
if (!artist.isNullOrBlank() && author != artist) { if (!artist.isNullOrBlank() && author != artist) {
Row(
modifier = Modifier.secondaryItemAlpha(),
horizontalArrangement = Arrangement.spacedBy(4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
imageVector = Icons.Filled.Brush,
contentDescription = null,
modifier = Modifier.size(16.dp),
)
Text( Text(
text = artist, text = artist,
style = MaterialTheme.typography.titleSmall, style = MaterialTheme.typography.titleSmall,
modifier = Modifier modifier = Modifier
.secondaryItemAlpha()
.padding(top = 2.dp)
.clickableNoIndication( .clickableNoIndication(
onLongClick = { context.copyToClipboard(artist, artist) }, onLongClick = { context.copyToClipboard(artist, artist) },
onClick = { doSearch(artist, true) }, onClick = { doSearch(artist, true) },
), ),
) )
} }
Spacer(modifier = Modifier.height(4.dp)) }
Spacer(modifier = Modifier.height(2.dp))
Row( Row(
modifier = Modifier.secondaryItemAlpha(), modifier = Modifier.secondaryItemAlpha(),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,