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,40 +490,63 @@ 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))
Text(
text = author?.takeIf { it.isNotBlank() } Row(
?: stringResource(R.string.unknown_author), modifier = Modifier.secondaryItemAlpha(),
style = MaterialTheme.typography.titleSmall, horizontalArrangement = Arrangement.spacedBy(4.dp),
modifier = Modifier verticalAlignment = Alignment.CenterVertically,
.secondaryItemAlpha() ) {
.padding(top = 2.dp) Icon(
.clickableNoIndication( imageVector = Icons.Filled.PersonOutline,
onLongClick = { contentDescription = null,
if (!author.isNullOrBlank()) { modifier = Modifier.size(16.dp),
context.copyToClipboard( )
author,
author,
)
}
},
onClick = { if (!author.isNullOrBlank()) doSearch(author, true) },
),
)
if (!artist.isNullOrBlank() && author != artist) {
Text( Text(
text = artist, text = author?.takeIf { it.isNotBlank() }
?: 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 = { context.copyToClipboard(artist, artist) }, onLongClick = {
onClick = { doSearch(artist, true) }, if (!author.isNullOrBlank()) {
context.copyToClipboard(
author,
author,
)
}
},
onClick = { if (!author.isNullOrBlank()) doSearch(author, true) },
), ),
) )
} }
Spacer(modifier = Modifier.height(4.dp))
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 = artist,
style = MaterialTheme.typography.titleSmall,
modifier = Modifier
.clickableNoIndication(
onLongClick = { context.copyToClipboard(artist, artist) },
onClick = { doSearch(artist, true) },
),
)
}
}
Spacer(modifier = Modifier.height(2.dp))
Row( Row(
modifier = Modifier.secondaryItemAlpha(), modifier = Modifier.secondaryItemAlpha(),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,