Carbs dialog Extend limit to one week in the past

This commit is contained in:
Philoul 2022-02-26 23:10:16 +01:00
parent bbe6248f81
commit 8940cdb66c

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(