added error label for breaktimeEdit
This commit is contained in:
parent
4d064ad319
commit
3fc3bee8c2
1 changed files with 17 additions and 1 deletions
|
@ -1,8 +1,13 @@
|
|||
package be.ugent.sel.studeez.screens.timer_edit.editScreens
|
||||
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import be.ugent.sel.studeez.R
|
||||
import be.ugent.sel.studeez.common.composable.LabeledErrorTextField
|
||||
import be.ugent.sel.studeez.common.composable.LabeledNumberInputField
|
||||
import be.ugent.sel.studeez.common.composable.TimePickerButton
|
||||
import be.ugent.sel.studeez.common.composable.TimePickerCard
|
||||
import be.ugent.sel.studeez.data.local.models.timer_functional.HoursMinutesSeconds
|
||||
|
@ -10,6 +15,7 @@ import be.ugent.sel.studeez.data.local.models.timer_functional.Time
|
|||
import be.ugent.sel.studeez.data.local.models.timer_info.CustomTimerInfo
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.EndlessTimerInfo
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.PomodoroTimerInfo
|
||||
import be.ugent.sel.studeez.resources
|
||||
import be.ugent.sel.studeez.ui.theme.StudeezTheme
|
||||
|
||||
class BreakTimerEditScreen(
|
||||
|
@ -26,8 +32,18 @@ class BreakTimerEditScreen(
|
|||
TimePickerCard(R.string.breakTime, breakTimerInfo.breakTime) { newTime ->
|
||||
breakTimerInfo.breakTime = newTime
|
||||
}
|
||||
}
|
||||
|
||||
LabeledErrorTextField(
|
||||
initialValue = breakTimerInfo.repeats.toString(),
|
||||
label = R.string.repeats,
|
||||
errorText = resources().getString(R.string.repeats_error),
|
||||
keyboardType = KeyboardType.Decimal,
|
||||
predicate = { it.matches(Regex("[1-9]+\\d*")) }
|
||||
) { correctlyTypedInt ->
|
||||
breakTimerInfo.repeats = correctlyTypedInt.toInt()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
|
|
Reference in a new issue