From 59ffb2ea8e0be0c3973f0842fcac5be38a9c400d Mon Sep 17 00:00:00 2001 From: tarsin Date: Mon, 23 Jan 2023 14:00:17 +0800 Subject: [PATCH] Fix ComposeSimpleRatingView --- .../com/hippo/ehviewer/ui/scene/history/HistoryScreen.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/history/HistoryScreen.kt b/app/src/main/java/com/hippo/ehviewer/ui/scene/history/HistoryScreen.kt index 95673e2d0..1638e80ff 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/history/HistoryScreen.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/history/HistoryScreen.kt @@ -182,7 +182,7 @@ private fun InfoCard(info: GalleryInfo) { AsyncImage( model = info.thumb, contentDescription = "", - contentScale = ContentScale.FillHeight, + contentScale = ContentScale.Crop, modifier = Modifier .width((listCardSize * 2).dp) .height((listCardSize * 3).dp) @@ -255,8 +255,7 @@ private fun InfoCard(info: GalleryInfo) { @Composable private fun ComposeSimpleRatingView(rating: Float) { - val r = (rating * 2).toInt() - check(r in 0..10) + val r = (rating * 2).toInt().coerceAtLeast(0).coerceAtMost(10) val fullStar = r.floorDiv(2) val halfStar = r % 2 val outlineStar = 5 - fullStar - halfStar