From 0bb20a92af348ae3fea3f6271999b51fd19a2ff1 Mon Sep 17 00:00:00 2001 From: Andreas Date: Sat, 27 Aug 2022 23:50:00 +0200 Subject: [PATCH] Fix issue with input for DownloadCustomChaptersDialog (#7873) --- .../manga/components/DownloadCustomChaptersDialog.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/DownloadCustomChaptersDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/components/DownloadCustomChaptersDialog.kt index b72f18cba9..0e46e0580c 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/DownloadCustomChaptersDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/DownloadCustomChaptersDialog.kt @@ -54,18 +54,18 @@ fun DownloadCustomAmountDialog( Text(text = stringResource(R.string.custom_download)) }, text = { - val onChangeAmount: (Int) -> Unit = { amount = (amount + it).coerceIn(0, maxAmount) } + val setAmount: (Int) -> Unit = { amount = it.coerceIn(0, maxAmount) } Row( verticalAlignment = Alignment.CenterVertically, ) { IconButton( - onClick = { onChangeAmount(-10) }, + onClick = { setAmount(amount - 10) }, enabled = amount > 0, ) { Icon(imageVector = Icons.Outlined.KeyboardDoubleArrowLeft, contentDescription = "") } IconButton( - onClick = { onChangeAmount(-1) }, + onClick = { setAmount(amount - 1) }, enabled = amount > 0, ) { Icon(imageVector = Icons.Outlined.ChevronLeft, contentDescription = "") @@ -73,18 +73,18 @@ fun DownloadCustomAmountDialog( OutlinedTextField( modifier = Modifier.weight(1f), value = amount.toString(), - onValueChange = { onChangeAmount(it.toIntOrNull() ?: 0) }, + onValueChange = { setAmount(it.toIntOrNull() ?: 0) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), textStyle = LocalTextStyle.current.copy(textAlign = TextAlign.Center), ) IconButton( - onClick = { onChangeAmount(1) }, + onClick = { setAmount(amount + 1) }, enabled = amount < maxAmount, ) { Icon(imageVector = Icons.Outlined.ChevronRight, contentDescription = "") } IconButton( - onClick = { onChangeAmount(10) }, + onClick = { setAmount(amount + 10) }, enabled = amount < maxAmount, ) { Icon(imageVector = Icons.Outlined.KeyboardDoubleArrowRight, contentDescription = "")