From bff98ca76830accfe462d011d42040ae6c1876e8 Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 8 Feb 2023 22:17:40 -0500 Subject: [PATCH] Clean up chapter item composables a bit Might help with #9043? --- .../manga/components/MangaChapterListItem.kt | 9 +++++---- .../eu/kanade/presentation/updates/UpdatesUiItem.kt | 11 ++++++----- 2 files changed, 11 insertions(+), 9 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 db458a8ed..0f8a76ed9 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 @@ -52,6 +52,9 @@ fun MangaChapterListItem( onClick: () -> Unit, onDownloadClick: ((ChapterDownloadAction) -> Unit)?, ) { + val textAlpha = if (read) ReadItemAlpha else 1f + val textSubtitleAlpha = if (read) ReadItemAlpha else SecondaryItemAlpha + Row( modifier = modifier .selectedBackground(selected) @@ -62,9 +65,6 @@ fun MangaChapterListItem( .padding(start = 16.dp, top = 12.dp, end = 8.dp, bottom = 12.dp), ) { Column(modifier = Modifier.weight(1f)) { - val textAlpha = remember(read) { if (read) ReadItemAlpha else 1f } - val textSubtitleAlpha = remember(read) { if (read) ReadItemAlpha else SecondaryItemAlpha } - Row(verticalAlignment = Alignment.CenterVertically) { var textHeight by remember { mutableStateOf(0) } if (bookmark) { @@ -86,7 +86,9 @@ fun MangaChapterListItem( modifier = Modifier.alpha(textAlpha), ) } + Spacer(modifier = Modifier.height(6.dp)) + Row(modifier = Modifier.alpha(textSubtitleAlpha)) { ProvideTextStyle( value = MaterialTheme.typography.bodyMedium.copy(fontSize = 12.sp), @@ -119,7 +121,6 @@ fun MangaChapterListItem( } } - // Download view if (onDownloadClick != null) { ChapterDownloadIndicator( enabled = downloadIndicatorEnabled, 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 57d03c2f3..02770133d 100644 --- a/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt +++ b/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt @@ -158,6 +158,8 @@ fun UpdatesUiItem( downloadProgressProvider: () -> Int, ) { val haptic = LocalHapticFeedback.current + val textAlpha = if (update.read) ReadItemAlpha else 1f + Row( modifier = modifier .selectedBackground(selected) @@ -179,15 +181,12 @@ fun UpdatesUiItem( data = update.coverData, onClick = onClickCover, ) + Column( modifier = Modifier .padding(horizontal = MaterialTheme.padding.medium) .weight(1f), ) { - val bookmark = remember(update.bookmark) { update.bookmark } - val read = remember(update.read) { update.read } - val textAlpha = remember(read) { if (read) ReadItemAlpha else 1f } - Text( text = update.mangaTitle, maxLines = 1, @@ -195,9 +194,10 @@ fun UpdatesUiItem( overflow = TextOverflow.Ellipsis, modifier = Modifier.alpha(textAlpha), ) + Row(verticalAlignment = Alignment.CenterVertically) { var textHeight by remember { mutableStateOf(0) } - if (bookmark) { + if (update.bookmark) { Icon( imageVector = Icons.Filled.Bookmark, contentDescription = stringResource(R.string.action_filter_bookmarked), @@ -228,6 +228,7 @@ fun UpdatesUiItem( } } } + ChapterDownloadIndicator( enabled = onDownloadChapter != null, modifier = Modifier.padding(start = 4.dp),