From 06c95b8d3635882a77f0f707fa9fde0ddbc0b3a1 Mon Sep 17 00:00:00 2001 From: tarsin Date: Wed, 25 Jan 2023 10:55:21 +0800 Subject: [PATCH] Tweak galleryInfoCard compose caching --- .../com/hippo/ehviewer/ui/widget/GalleryInfoCard.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/widget/GalleryInfoCard.kt b/app/src/main/java/com/hippo/ehviewer/ui/widget/GalleryInfoCard.kt index db0c5935c..9e7998caa 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/widget/GalleryInfoCard.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/widget/GalleryInfoCard.kt @@ -86,16 +86,11 @@ fun ListInfoCard( style = MaterialTheme.typography.labelLarge ) SimpleRatingWidget(rating = info.rating) + val categoryColor = remember { EhUtils.getCategoryColor(info.category) } Text( text = EhUtils.getCategory(info.category).uppercase(Locale.ROOT), modifier = Modifier - .background( - Color( - EhUtils.getCategoryColor( - info.category - ) - ) - ) + .background(Color(categoryColor)) .padding(vertical = 2.dp, horizontal = 8.dp), color = Color.White, textAlign = TextAlign.Center, @@ -105,7 +100,8 @@ fun ListInfoCard( Spacer(modifier = Modifier.weight(1f)) Column(horizontalAlignment = Alignment.End) { Row(verticalAlignment = Alignment.CenterVertically) { - if (remember { downloadManager.containDownloadInfo(info.gid) }) { + // TODO: put this calculation in coroutines + if (downloadManager.containDownloadInfo(info.gid)) { Icon( painterResource(id = R.drawable.v_download_x16), contentDescription = null