prevent NPE
This commit is contained in:
parent
0f92e5409d
commit
0774aa46d0
1 changed files with 8 additions and 7 deletions
|
@ -143,7 +143,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
)
|
)
|
||||||
val plus1text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT))
|
val plus1text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT))
|
||||||
binding.plus1.text = plus1text
|
binding.plus1.text = plus1text
|
||||||
binding.plus1.contentDescription = rh.gs(R.string.treatments_wizard_carbs_label) + " " + plus1text
|
binding.plus1.contentDescription = rh.gs(R.string.treatments_wizard_carbs_label) + " " + plus1text
|
||||||
binding.plus1.setOnClickListener {
|
binding.plus1.setOnClickListener {
|
||||||
binding.carbs.value = max(
|
binding.carbs.value = max(
|
||||||
0.0, binding.carbs.value
|
0.0, binding.carbs.value
|
||||||
|
@ -155,7 +155,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
val plus2text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT))
|
val plus2text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT))
|
||||||
binding.plus2.text = plus2text
|
binding.plus2.text = plus2text
|
||||||
binding.plus2.contentDescription = rh.gs(R.string.treatments_wizard_carbs_label) + " " + plus2text
|
binding.plus2.contentDescription = rh.gs(R.string.treatments_wizard_carbs_label) + " " + plus2text
|
||||||
binding.plus2.setOnClickListener {
|
binding.plus2.setOnClickListener {
|
||||||
binding.carbs.value = max(
|
binding.carbs.value = max(
|
||||||
0.0, binding.carbs.value
|
0.0, binding.carbs.value
|
||||||
|
@ -166,7 +166,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
val plus3text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT))
|
val plus3text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT))
|
||||||
binding.plus3.text = plus3text
|
binding.plus3.text = plus3text
|
||||||
binding.plus2.contentDescription = rh.gs(R.string.treatments_wizard_carbs_label) + " " + plus3text
|
binding.plus2.contentDescription = rh.gs(R.string.treatments_wizard_carbs_label) + " " + plus3text
|
||||||
binding.plus3.setOnClickListener {
|
binding.plus3.setOnClickListener {
|
||||||
binding.carbs.value = max(
|
binding.carbs.value = max(
|
||||||
0.0, binding.carbs.value
|
0.0, binding.carbs.value
|
||||||
|
@ -179,7 +179,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
setOnValueChangedListener { eventTime: Long ->
|
setOnValueChangedListener { eventTime: Long ->
|
||||||
run {
|
run {
|
||||||
val timeOffset = ((eventTime - eventTimeOriginal) / (1000 * 60)).toDouble()
|
val timeOffset = ((eventTime - eventTimeOriginal) / (1000 * 60)).toDouble()
|
||||||
binding.time.value = timeOffset
|
if (_binding != null) binding.time.value = timeOffset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +250,8 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
val hypoSelected = binding.hypoTt.isChecked
|
val hypoSelected = binding.hypoTt.isChecked
|
||||||
if (hypoSelected)
|
if (hypoSelected)
|
||||||
actions.add(
|
actions.add(
|
||||||
rh.gs(R.string.temptargetshort) + ": " + (DecimalFormatter.to1Decimal(hypoTT) + " " + unitLabel + " (" + rh.gs(R.string.format_mins, hypoTTDuration) + ")").formatColor( context,
|
rh.gs(R.string.temptargetshort) + ": " + (DecimalFormatter.to1Decimal(hypoTT) + " " + unitLabel + " (" + rh.gs(R.string.format_mins, hypoTTDuration) + ")").formatColor(
|
||||||
|
context,
|
||||||
rh,
|
rh,
|
||||||
R.attr.tempTargetConfirmation
|
R.attr.tempTargetConfirmation
|
||||||
)
|
)
|
||||||
|
@ -258,7 +259,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
val timeOffset = binding.time.value.toInt()
|
val timeOffset = binding.time.value.toInt()
|
||||||
if (useAlarm && carbs > 0 && timeOffset > 0)
|
if (useAlarm && carbs > 0 && timeOffset > 0)
|
||||||
actions.add(rh.gs(R.string.alarminxmin, timeOffset).formatColor(context , rh, R.attr.infoColor))
|
actions.add(rh.gs(R.string.alarminxmin, timeOffset).formatColor(context, rh, R.attr.infoColor))
|
||||||
val duration = binding.duration.value.toInt()
|
val duration = binding.duration.value.toInt()
|
||||||
if (duration > 0)
|
if (duration > 0)
|
||||||
actions.add(rh.gs(R.string.duration) + ": " + duration + rh.gs(R.string.shorthour))
|
actions.add(rh.gs(R.string.duration) + ": " + duration + rh.gs(R.string.shorthour))
|
||||||
|
@ -385,7 +386,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
if(!queryingProtection) {
|
if (!queryingProtection) {
|
||||||
queryingProtection = true
|
queryingProtection = true
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
val cancelFail = {
|
val cancelFail = {
|
||||||
|
|
Loading…
Reference in a new issue