MangaInfoHeader tweaks (#7382)

* Changed cover alignment when title is longer
* Hide artist text if it's equal to author
* Set single line to status and source name
This commit is contained in:
Ivan Iskandar 2022-06-26 23:48:29 +07:00 committed by GitHub
parent b34b10c6b8
commit 6129bbc9ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,6 +64,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Constraints import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@ -316,7 +317,7 @@ private fun MangaAndSourceTitlesLarge(
), ),
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
) )
if (!artist.isNullOrBlank()) { if (!artist.isNullOrBlank() && author != artist) {
Text( Text(
text = artist, text = artist,
style = MaterialTheme.typography.titleSmall, style = MaterialTheme.typography.titleSmall,
@ -361,6 +362,8 @@ private fun MangaAndSourceTitlesLarge(
SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus) SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
else -> stringResource(R.string.unknown) else -> stringResource(R.string.unknown)
}, },
overflow = TextOverflow.Ellipsis,
maxLines = 1,
) )
DotSeparatorText() DotSeparatorText()
if (isStubSource) { if (isStubSource) {
@ -376,6 +379,8 @@ private fun MangaAndSourceTitlesLarge(
Text( Text(
text = sourceName, text = sourceName,
modifier = Modifier.clickableNoIndication { doSearch(sourceName, false) }, modifier = Modifier.clickableNoIndication { doSearch(sourceName, false) },
overflow = TextOverflow.Ellipsis,
maxLines = 1,
) )
} }
} }
@ -403,7 +408,9 @@ private fun MangaAndSourceTitlesSmall(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
MangaCover.Book( MangaCover.Book(
modifier = Modifier.sizeIn(maxWidth = 100.dp), modifier = Modifier
.sizeIn(maxWidth = 100.dp)
.align(Alignment.Top),
data = coverDataProvider(), data = coverDataProvider(),
onClick = onCoverClick, onClick = onCoverClick,
) )
@ -439,7 +446,7 @@ private fun MangaAndSourceTitlesSmall(
onClick = { if (!author.isNullOrBlank()) doSearch(author, true) }, onClick = { if (!author.isNullOrBlank()) doSearch(author, true) },
), ),
) )
if (!artist.isNullOrBlank()) { if (!artist.isNullOrBlank() && author != artist) {
Text( Text(
text = artist, text = artist,
style = MaterialTheme.typography.titleSmall, style = MaterialTheme.typography.titleSmall,
@ -483,6 +490,8 @@ private fun MangaAndSourceTitlesSmall(
SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus) SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
else -> stringResource(R.string.unknown) else -> stringResource(R.string.unknown)
}, },
overflow = TextOverflow.Ellipsis,
maxLines = 1,
) )
DotSeparatorText() DotSeparatorText()
if (isStubSource) { if (isStubSource) {
@ -503,6 +512,8 @@ private fun MangaAndSourceTitlesSmall(
false, false,
) )
}, },
overflow = TextOverflow.Ellipsis,
maxLines = 1,
) )
} }
} }