ChapterDownloadIndicator: Ensure uniform hit area (#7453)

This commit is contained in:
AntsyLich 2022-07-05 08:36:59 +06:00 committed by GitHub
parent 591df8abcc
commit eef95cef33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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