Merge pull request #1391 from Philoul/New/ReduceTimeOffsetConstraintinCarbsDialog

Modify Constraint of Carbs Dialog for Time Offset in past
This commit is contained in:
Milos Kozak 2022-02-27 21:49:19 +01:00 committed by GitHub
commit 1d2a25b56c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -72,7 +72,7 @@ class CarbsDialog : DialogFragmentWithDate() {
private fun validateInputs() {
val maxCarbs = constraintChecker.getMaxCarbsAllowed().value().toDouble()
val time = binding.time.value.toInt()
if (time > 12 * 60 || time < -12 * 60) {
if (time > 12 * 60 || time < -7 * 24 * 60) {
binding.time.value = 0.0
ToastUtils.showToastInUiThread(ctx, rh.gs(R.string.constraintapllied))
}
@ -125,7 +125,7 @@ class CarbsDialog : DialogFragmentWithDate() {
val maxCarbs = constraintChecker.getMaxCarbsAllowed().value().toDouble()
binding.time.setParams(
savedInstanceState?.getDouble("time")
?: 0.0, -12 * 60.0, 12 * 60.0, 5.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher
?: 0.0, -7 * 24 * 60.0, 12 * 60.0, 5.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher
)
binding.duration.setParams(