From eef95cef336f805881b124dd2c5f465c3fd73bc6 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Tue, 5 Jul 2022 08:36:59 +0600 Subject: [PATCH] ChapterDownloadIndicator: Ensure uniform hit area (#7453) --- .../components/ChapterDownloadIndicator.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/components/ChapterDownloadIndicator.kt b/app/src/main/java/eu/kanade/presentation/components/ChapterDownloadIndicator.kt index b3474b4520..b8967ee84a 100644 --- a/app/src/main/java/eu/kanade/presentation/components/ChapterDownloadIndicator.kt +++ b/app/src/main/java/eu/kanade/presentation/components/ChapterDownloadIndicator.kt @@ -59,11 +59,14 @@ fun ChapterDownloadIndicator( onClick(chapterDownloadAction) }, ) { + val indicatorModifier = Modifier + .size(IndicatorSize) + .padding(IndicatorPadding) if (isDownloaded) { Icon( imageVector = Icons.Default.CheckCircle, contentDescription = null, - modifier = Modifier.size(IndicatorSize), + modifier = indicatorModifier, tint = MaterialTheme.colorScheme.onSurfaceVariant, ) DropdownMenu(expanded = isMenuExpanded, onDismissRequest = { isMenuExpanded = false }) { @@ -76,9 +79,6 @@ fun ChapterDownloadIndicator( ) } } else { - val progressIndicatorModifier = Modifier - .size(IndicatorSize) - .padding(IndicatorStrokeWidth) val inactiveAlphaModifier = if (!isDownloading) Modifier.secondaryItemAlpha() else Modifier val arrowModifier = Modifier .size(IndicatorSize - 7.dp) @@ -91,7 +91,7 @@ fun ChapterDownloadIndicator( if (indeterminate) { arrowColor = strokeColor CircularProgressIndicator( - modifier = progressIndicatorModifier, + modifier = indicatorModifier, color = strokeColor, strokeWidth = IndicatorStrokeWidth, ) @@ -107,7 +107,7 @@ fun ChapterDownloadIndicator( } CircularProgressIndicator( progress = animatedProgress, - modifier = progressIndicatorModifier, + modifier = indicatorModifier, color = strokeColor, strokeWidth = IndicatorSize / 2, ) @@ -116,7 +116,7 @@ fun ChapterDownloadIndicator( arrowColor = strokeColor CircularProgressIndicator( progress = 1f, - modifier = progressIndicatorModifier.then(inactiveAlphaModifier), + modifier = indicatorModifier.then(inactiveAlphaModifier), color = strokeColor, strokeWidth = IndicatorStrokeWidth, ) @@ -150,4 +150,6 @@ fun ChapterDownloadIndicator( } private val IndicatorSize = 26.dp -private val IndicatorStrokeWidth = 2.dp +private val IndicatorPadding = 2.dp +// To match composable parameter name when used later +private val IndicatorStrokeWidth = IndicatorPadding