Fix chapter item incorrect colors (#7403)

* Fix chapter item incorrect colors

* Make it like stable
This commit is contained in:
AntsyLich 2022-06-30 04:34:11 +06:00 committed by GitHub
parent 0969226fd3
commit 08d1ecfba7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,16 +59,14 @@ fun MangaChapterListItem(
) )
.padding(start = 16.dp, top = 12.dp, end = 8.dp, bottom = 12.dp), .padding(start = 16.dp, top = 12.dp, end = 8.dp, bottom = 12.dp),
) { ) {
Column( Column(modifier = Modifier.weight(1f)) {
modifier = Modifier val textColor = if (bookmark && !read) {
.weight(1f)
.alpha(if (read) ReadItemAlpha else 1f),
) {
val textColor = if (bookmark) {
MaterialTheme.colorScheme.primary MaterialTheme.colorScheme.primary
} else { } else {
MaterialTheme.colorScheme.onSurface MaterialTheme.colorScheme.onSurface
} }
val textAlpha = remember(read) { if (read) ReadItemAlpha else 1f }
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
var textHeight by remember { mutableStateOf(0) } var textHeight by remember { mutableStateOf(0) }
if (bookmark) { if (bookmark) {
@ -77,7 +75,7 @@ fun MangaChapterListItem(
contentDescription = stringResource(R.string.action_filter_bookmarked), contentDescription = stringResource(R.string.action_filter_bookmarked),
modifier = Modifier modifier = Modifier
.sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }), .sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }),
tint = textColor, tint = MaterialTheme.colorScheme.primary,
) )
Spacer(modifier = Modifier.width(2.dp)) Spacer(modifier = Modifier.width(2.dp))
} }
@ -88,10 +86,11 @@ fun MangaChapterListItem(
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
onTextLayout = { textHeight = it.size.height }, onTextLayout = { textHeight = it.size.height },
modifier = Modifier.alpha(textAlpha),
) )
} }
Spacer(modifier = Modifier.height(6.dp)) Spacer(modifier = Modifier.height(6.dp))
Row { Row(modifier = Modifier.alpha(textAlpha)) {
ProvideTextStyle( ProvideTextStyle(
value = MaterialTheme.typography.bodyMedium value = MaterialTheme.typography.bodyMedium
.copy(color = textColor, fontSize = 12.sp), .copy(color = textColor, fontSize = 12.sp),