From e458de5e9c845ac5a278aec397b7a0cdbd4f94ed Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 5 Mar 2023 17:47:27 -0500 Subject: [PATCH] Add dot beside unread chapter names Closes #4261 Also includes changes that might help with #9043 --- .../manga/components/MangaChapterListItem.kt | 37 ++++++++++++++----- .../presentation/updates/UpdatesUiItem.kt | 20 ++++++++-- 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaChapterListItem.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaChapterListItem.kt index cbdffe415..3a21ec0ed 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaChapterListItem.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaChapterListItem.kt @@ -1,16 +1,17 @@ package eu.kanade.presentation.manga.components import androidx.compose.foundation.combinedClickable +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.sizeIn -import androidx.compose.foundation.layout.width import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Bookmark +import androidx.compose.material.icons.filled.Circle import androidx.compose.material3.Icon +import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ProvideTextStyle import androidx.compose.material3.Text @@ -62,9 +63,25 @@ fun MangaChapterListItem( ) .padding(start = 16.dp, top = 12.dp, end = 8.dp, bottom = 12.dp), ) { - Column(modifier = Modifier.weight(1f)) { - Row(verticalAlignment = Alignment.CenterVertically) { + Column( + modifier = Modifier.weight(1f), + verticalArrangement = Arrangement.spacedBy(6.dp), + ) { + Row( + horizontalArrangement = Arrangement.spacedBy(2.dp), + verticalAlignment = Alignment.CenterVertically, + ) { var textHeight by remember { mutableStateOf(0) } + if (!read) { + Icon( + imageVector = Icons.Filled.Circle, + contentDescription = stringResource(R.string.unread), + modifier = Modifier + .height(8.dp) + .padding(end = 4.dp), + tint = MaterialTheme.colorScheme.primary, + ) + } if (bookmark) { Icon( imageVector = Icons.Filled.Bookmark, @@ -73,23 +90,23 @@ fun MangaChapterListItem( .sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }), tint = MaterialTheme.colorScheme.primary, ) - Spacer(modifier = Modifier.width(2.dp)) } Text( text = title, style = MaterialTheme.typography.bodyMedium, + color = LocalContentColor.current.copy(alpha = textAlpha), maxLines = 1, overflow = TextOverflow.Ellipsis, onTextLayout = { textHeight = it.size.height }, - modifier = Modifier.alpha(textAlpha), ) } - Spacer(modifier = Modifier.height(6.dp)) - - Row(modifier = Modifier.alpha(textSubtitleAlpha)) { + Row { ProvideTextStyle( - value = MaterialTheme.typography.bodyMedium.copy(fontSize = 12.sp), + value = MaterialTheme.typography.bodyMedium.copy( + fontSize = 12.sp, + color = LocalContentColor.current.copy(alpha = textSubtitleAlpha), + ), ) { if (date != null) { Text( diff --git a/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt b/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt index 3546ccabe..630d080cb 100644 --- a/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt +++ b/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt @@ -15,7 +15,9 @@ import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.items import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Bookmark +import androidx.compose.material.icons.filled.Circle import androidx.compose.material3.Icon +import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -191,12 +193,22 @@ fun UpdatesUiItem( text = update.mangaTitle, maxLines = 1, style = MaterialTheme.typography.bodyMedium, + color = LocalContentColor.current.copy(alpha = textAlpha), overflow = TextOverflow.Ellipsis, - modifier = Modifier.alpha(textAlpha), ) Row(verticalAlignment = Alignment.CenterVertically) { var textHeight by remember { mutableStateOf(0) } + if (!update.read) { + Icon( + imageVector = Icons.Filled.Circle, + contentDescription = stringResource(R.string.unread), + modifier = Modifier + .height(8.dp) + .padding(end = 4.dp), + tint = MaterialTheme.colorScheme.primary, + ) + } if (update.bookmark) { Icon( imageVector = Icons.Filled.Bookmark, @@ -211,19 +223,19 @@ fun UpdatesUiItem( text = update.chapterName, maxLines = 1, style = MaterialTheme.typography.bodySmall, + color = LocalContentColor.current.copy(alpha = textAlpha), overflow = TextOverflow.Ellipsis, onTextLayout = { textHeight = it.size.height }, modifier = Modifier - .weight(weight = 1f, fill = false) - .alpha(textAlpha), + .weight(weight = 1f, fill = false), ) if (readProgress != null) { DotSeparatorText() Text( text = readProgress, maxLines = 1, + color = LocalContentColor.current.copy(alpha = ReadItemAlpha), overflow = TextOverflow.Ellipsis, - modifier = Modifier.alpha(ReadItemAlpha), ) } }