mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 20:31:02 -05:00
Fix issue with input for DownloadCustomChaptersDialog (#7873)
This commit is contained in:
parent
cd82c88b9a
commit
0bb20a92af
1 changed files with 6 additions and 6 deletions
|
@ -54,18 +54,18 @@ fun DownloadCustomAmountDialog(
|
||||||
Text(text = stringResource(R.string.custom_download))
|
Text(text = stringResource(R.string.custom_download))
|
||||||
},
|
},
|
||||||
text = {
|
text = {
|
||||||
val onChangeAmount: (Int) -> Unit = { amount = (amount + it).coerceIn(0, maxAmount) }
|
val setAmount: (Int) -> Unit = { amount = it.coerceIn(0, maxAmount) }
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = { onChangeAmount(-10) },
|
onClick = { setAmount(amount - 10) },
|
||||||
enabled = amount > 0,
|
enabled = amount > 0,
|
||||||
) {
|
) {
|
||||||
Icon(imageVector = Icons.Outlined.KeyboardDoubleArrowLeft, contentDescription = "")
|
Icon(imageVector = Icons.Outlined.KeyboardDoubleArrowLeft, contentDescription = "")
|
||||||
}
|
}
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = { onChangeAmount(-1) },
|
onClick = { setAmount(amount - 1) },
|
||||||
enabled = amount > 0,
|
enabled = amount > 0,
|
||||||
) {
|
) {
|
||||||
Icon(imageVector = Icons.Outlined.ChevronLeft, contentDescription = "")
|
Icon(imageVector = Icons.Outlined.ChevronLeft, contentDescription = "")
|
||||||
|
@ -73,18 +73,18 @@ fun DownloadCustomAmountDialog(
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
value = amount.toString(),
|
value = amount.toString(),
|
||||||
onValueChange = { onChangeAmount(it.toIntOrNull() ?: 0) },
|
onValueChange = { setAmount(it.toIntOrNull() ?: 0) },
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
||||||
textStyle = LocalTextStyle.current.copy(textAlign = TextAlign.Center),
|
textStyle = LocalTextStyle.current.copy(textAlign = TextAlign.Center),
|
||||||
)
|
)
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = { onChangeAmount(1) },
|
onClick = { setAmount(amount + 1) },
|
||||||
enabled = amount < maxAmount,
|
enabled = amount < maxAmount,
|
||||||
) {
|
) {
|
||||||
Icon(imageVector = Icons.Outlined.ChevronRight, contentDescription = "")
|
Icon(imageVector = Icons.Outlined.ChevronRight, contentDescription = "")
|
||||||
}
|
}
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = { onChangeAmount(10) },
|
onClick = { setAmount(amount + 10) },
|
||||||
enabled = amount < maxAmount,
|
enabled = amount < maxAmount,
|
||||||
) {
|
) {
|
||||||
Icon(imageVector = Icons.Outlined.KeyboardDoubleArrowRight, contentDescription = "")
|
Icon(imageVector = Icons.Outlined.KeyboardDoubleArrowRight, contentDescription = "")
|
||||||
|
|
Loading…
Reference in a new issue