fix(settings): fix crash that occurred when editing time

Closes: #120
This commit is contained in:
Nishant Mishra
2025-11-07 16:33:24 +05:30
parent eb167e22e8
commit 61cc5243f1
4 changed files with 17 additions and 25 deletions

View File

@@ -101,15 +101,9 @@ fun SettingsScreenRoot(
onDispose { viewModel.cancelTextFieldFlowCollection() }
}
val focusTimeInputFieldState = rememberSaveable(saver = TextFieldState.Saver) {
viewModel.focusTimeTextFieldState
}
val shortBreakTimeInputFieldState = rememberSaveable(saver = TextFieldState.Saver) {
viewModel.shortBreakTimeTextFieldState
}
val longBreakTimeInputFieldState = rememberSaveable(saver = TextFieldState.Saver) {
viewModel.longBreakTimeTextFieldState
}
val focusTimeInputFieldState = viewModel.focusTimeTextFieldState
val shortBreakTimeInputFieldState = viewModel.shortBreakTimeTextFieldState
val longBreakTimeInputFieldState = viewModel.longBreakTimeTextFieldState
val isPlus by viewModel.isPlus.collectAsStateWithLifecycle()
val alarmEnabled by viewModel.alarmEnabled.collectAsStateWithLifecycle(true)

View File

@@ -54,7 +54,7 @@ fun MinuteInputField(
state = state,
lineLimits = TextFieldLineLimits.SingleLine,
inputTransformation = MinutesInputTransformation,
outputTransformation = MinutesOutputTransformation,
// outputTransformation = MinutesOutputTransformation,
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.NumberPassword,
imeAction = imeAction

View File

@@ -18,9 +18,7 @@
package org.nsh07.pomodoro.ui.settingsScreen.components
import androidx.compose.foundation.text.input.InputTransformation
import androidx.compose.foundation.text.input.OutputTransformation
import androidx.compose.foundation.text.input.TextFieldBuffer
import androidx.compose.foundation.text.input.insert
import androidx.core.text.isDigitsOnly
object MinutesInputTransformation : InputTransformation {
@@ -31,11 +29,11 @@ object MinutesInputTransformation : InputTransformation {
}
}
object MinutesOutputTransformation : OutputTransformation {
override fun TextFieldBuffer.transformOutput() {
when (this.length) {
0 -> insert(0, "00")
1 -> insert(0, "0")
}
}
}
//object MinutesOutputTransformation : OutputTransformation {
// override fun TextFieldBuffer.transformOutput() {
// when (this.length) {
// 0 -> insert(0, "00")
// 1 -> insert(0, "0")
// }
// }
//}

View File

@@ -2,17 +2,17 @@
activityCompose = "1.11.0"
adaptive = "1.2.0"
agp = "8.11.2"
composeBom = "2025.10.01"
composeBom = "2025.11.00"
coreKtx = "1.17.0"
espressoCore = "3.7.0"
junit = "4.13.2"
junitVersion = "1.3.0"
kotlin = "2.2.21"
ksp = "2.2.20-2.0.4"
ksp = "2.3.1"
lifecycleRuntimeKtx = "2.9.4"
materialKolor = "3.0.1"
navigation3 = "1.0.0-beta01"
revenuecat = "9.12.0"
materialKolor = "4.0.3"
navigation3 = "1.0.0-rc01"
revenuecat = "9.12.1"
room = "2.8.3"
vico = "2.2.1"