small cleanup
This commit is contained in:
parent
2ce590a700
commit
953d6bc029
18 changed files with 237 additions and 193 deletions
|
@ -3,7 +3,11 @@ package info.nightscout.androidaps.dialogs
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import android.view.*
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.Window
|
||||||
|
import android.view.WindowManager
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
@ -87,25 +91,25 @@ class BolusProgressDialog : DialogFragment() {
|
||||||
else running = true
|
else running = true
|
||||||
|
|
||||||
disposable.add(toObservable(EventPumpStatusChanged::class.java)
|
disposable.add(toObservable(EventPumpStatusChanged::class.java)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe({ overview_bolusprogress_status.text = it.getStatus() }) { FabricPrivacy.logException(it) }
|
.subscribe({ overview_bolusprogress_status.text = it.getStatus() }) { FabricPrivacy.logException(it) }
|
||||||
)
|
)
|
||||||
disposable.add(toObservable(EventDismissBolusProgressIfRunning::class.java)
|
disposable.add(toObservable(EventDismissBolusProgressIfRunning::class.java)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe({ if (running) dismiss() }) { FabricPrivacy.logException(it) }
|
.subscribe({ if (running) dismiss() }) { FabricPrivacy.logException(it) }
|
||||||
)
|
)
|
||||||
disposable.add(toObservable(EventOverviewBolusProgress::class.java)
|
disposable.add(toObservable(EventOverviewBolusProgress::class.java)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe({
|
.subscribe({
|
||||||
if (L.isEnabled(L.UI)) log.debug("Status: " + it.status + " Percent: " + it.percent)
|
if (L.isEnabled(L.UI)) log.debug("Status: " + it.status + " Percent: " + it.percent)
|
||||||
overview_bolusprogress_status.text = it.status
|
overview_bolusprogress_status.text = it.status
|
||||||
overview_bolusprogress_progressbar.progress = it.percent
|
overview_bolusprogress_progressbar.progress = it.percent
|
||||||
if (it.percent == 100) {
|
if (it.percent == 100) {
|
||||||
overview_bolusprogress_stop.visibility = View.INVISIBLE
|
overview_bolusprogress_stop.visibility = View.INVISIBLE
|
||||||
scheduleDismiss()
|
scheduleDismiss()
|
||||||
}
|
}
|
||||||
state = it.status
|
state = it.status
|
||||||
}) { FabricPrivacy.logException(it) }
|
}) { FabricPrivacy.logException(it) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.OKDialog
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
import info.nightscout.androidaps.utils.XdripCalibrations
|
import info.nightscout.androidaps.utils.XdripCalibrations
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
|
||||||
import kotlinx.android.synthetic.main.dialog_calibration.*
|
import kotlinx.android.synthetic.main.dialog_calibration.*
|
||||||
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class CalibrationDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_calibration, container, false)
|
return inflater.inflate(R.layout.dialog_calibration, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ class CalibrationDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
val units = ProfileFunctions.getSystemUnits()
|
val units = ProfileFunctions.getSystemUnits()
|
||||||
val bg = Profile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData()?.glucose
|
val bg = Profile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData()?.glucose
|
||||||
?: 0.0, units)
|
?: 0.0, units)
|
||||||
if (units == Constants.MMOL)
|
if (units == Constants.MMOL)
|
||||||
overview_calibration_bg.setParams(savedInstanceState?.getDouble("overview_calibration_bg")
|
overview_calibration_bg.setParams(savedInstanceState?.getDouble("overview_calibration_bg")
|
||||||
?: bg, 2.0, 30.0, 0.1, DecimalFormat("0.0"), false, ok)
|
?: bg, 2.0, 30.0, 0.1, DecimalFormat("0.0"), false, ok)
|
||||||
else
|
else
|
||||||
overview_calibration_bg.setParams(savedInstanceState?.getDouble("overview_calibration_bg")
|
overview_calibration_bg.setParams(savedInstanceState?.getDouble("overview_calibration_bg")
|
||||||
?: bg, 36.0, 500.0, 1.0, DecimalFormat("0"), false, ok)
|
?: bg, 36.0, 500.0, 1.0, DecimalFormat("0"), false, ok)
|
||||||
overview_calibration_units.text = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
|
overview_calibration_units.text = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,9 @@ import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.treatments.CarbsGenerator
|
import info.nightscout.androidaps.plugins.treatments.CarbsGenerator
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.*
|
||||||
|
import kotlinx.android.synthetic.main.dialog_carbs.*
|
||||||
import kotlinx.android.synthetic.main.notes.*
|
import kotlinx.android.synthetic.main.notes.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import kotlinx.android.synthetic.main.dialog_carbs.*
|
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
@ -72,7 +72,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_carbs, container, false)
|
return inflater.inflate(R.layout.dialog_carbs, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,32 +80,32 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
overview_carbs_time.setParams(savedInstanceState?.getDouble("overview_carbs_time")
|
overview_carbs_time.setParams(savedInstanceState?.getDouble("overview_carbs_time")
|
||||||
?: 0.0, -12 * 60.0, 12 * 60.0, 5.0, DecimalFormat("0"), false, ok, textWatcher)
|
?: 0.0, -12 * 60.0, 12 * 60.0, 5.0, DecimalFormat("0"), false, ok, textWatcher)
|
||||||
|
|
||||||
overview_carbs_duration.setParams(savedInstanceState?.getDouble("overview_carbs_duration")
|
overview_carbs_duration.setParams(savedInstanceState?.getDouble("overview_carbs_duration")
|
||||||
?: 0.0, 0.0, 10.0, 1.0, DecimalFormat("0"), false, ok, textWatcher)
|
?: 0.0, 0.0, 10.0, 1.0, DecimalFormat("0"), false, ok, textWatcher)
|
||||||
|
|
||||||
overview_carbs_carbs.setParams(savedInstanceState?.getDouble("overview_carbs_carbs")
|
overview_carbs_carbs.setParams(savedInstanceState?.getDouble("overview_carbs_carbs")
|
||||||
?: 0.0, 0.0, maxCarbs, 1.0, DecimalFormat("0"), false, ok, textWatcher)
|
?: 0.0, 0.0, maxCarbs, 1.0, DecimalFormat("0"), false, ok, textWatcher)
|
||||||
|
|
||||||
overview_carbs_plus1.text = toSignedString(SP.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT))
|
overview_carbs_plus1.text = toSignedString(SP.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT))
|
||||||
overview_carbs_plus1.setOnClickListener {
|
overview_carbs_plus1.setOnClickListener {
|
||||||
overview_carbs_carbs.value = max(0.0, overview_carbs_carbs.value
|
overview_carbs_carbs.value = max(0.0, overview_carbs_carbs.value
|
||||||
+ SP.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT))
|
+ SP.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT))
|
||||||
validateInputs()
|
validateInputs()
|
||||||
}
|
}
|
||||||
|
|
||||||
overview_carbs_plus2.text = toSignedString(SP.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT))
|
overview_carbs_plus2.text = toSignedString(SP.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT))
|
||||||
overview_carbs_plus2.setOnClickListener {
|
overview_carbs_plus2.setOnClickListener {
|
||||||
overview_carbs_carbs.value = max(0.0, overview_carbs_carbs.value
|
overview_carbs_carbs.value = max(0.0, overview_carbs_carbs.value
|
||||||
+ SP.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT))
|
+ SP.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT))
|
||||||
validateInputs()
|
validateInputs()
|
||||||
}
|
}
|
||||||
|
|
||||||
overview_carbs_plus3.text = toSignedString(SP.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT))
|
overview_carbs_plus3.text = toSignedString(SP.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT))
|
||||||
overview_carbs_plus3.setOnClickListener {
|
overview_carbs_plus3.setOnClickListener {
|
||||||
overview_carbs_carbs.value = max(0.0, overview_carbs_carbs.value
|
overview_carbs_carbs.value = max(0.0, overview_carbs_carbs.value
|
||||||
+ SP.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT))
|
+ SP.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT))
|
||||||
validateInputs()
|
validateInputs()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,30 +175,30 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
OKDialog.showConfirmation(activity, HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions))) {
|
OKDialog.showConfirmation(activity, HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions))) {
|
||||||
if (activitySelected) {
|
if (activitySelected) {
|
||||||
val tempTarget = TempTarget()
|
val tempTarget = TempTarget()
|
||||||
.date(System.currentTimeMillis())
|
.date(System.currentTimeMillis())
|
||||||
.duration(activityTTDuration)
|
.duration(activityTTDuration)
|
||||||
.reason(MainApp.gs(R.string.activity))
|
.reason(MainApp.gs(R.string.activity))
|
||||||
.source(Source.USER)
|
.source(Source.USER)
|
||||||
.low(Profile.toMgdl(activityTT, ProfileFunctions.getSystemUnits()))
|
.low(Profile.toMgdl(activityTT, ProfileFunctions.getSystemUnits()))
|
||||||
.high(Profile.toMgdl(activityTT, ProfileFunctions.getSystemUnits()))
|
.high(Profile.toMgdl(activityTT, ProfileFunctions.getSystemUnits()))
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
|
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
|
||||||
} else if (eatingSoonSelected) {
|
} else if (eatingSoonSelected) {
|
||||||
val tempTarget = TempTarget()
|
val tempTarget = TempTarget()
|
||||||
.date(System.currentTimeMillis())
|
.date(System.currentTimeMillis())
|
||||||
.duration(eatingSoonTTDuration)
|
.duration(eatingSoonTTDuration)
|
||||||
.reason(MainApp.gs(R.string.eatingsoon))
|
.reason(MainApp.gs(R.string.eatingsoon))
|
||||||
.source(Source.USER)
|
.source(Source.USER)
|
||||||
.low(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
|
.low(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
|
||||||
.high(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
|
.high(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
|
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
|
||||||
} else if (hypoSelected) {
|
} else if (hypoSelected) {
|
||||||
val tempTarget = TempTarget()
|
val tempTarget = TempTarget()
|
||||||
.date(System.currentTimeMillis())
|
.date(System.currentTimeMillis())
|
||||||
.duration(hypoTTDuration)
|
.duration(hypoTTDuration)
|
||||||
.reason(MainApp.gs(R.string.hypo))
|
.reason(MainApp.gs(R.string.hypo))
|
||||||
.source(Source.USER)
|
.source(Source.USER)
|
||||||
.low(Profile.toMgdl(hypoTT, ProfileFunctions.getSystemUnits()))
|
.low(Profile.toMgdl(hypoTT, ProfileFunctions.getSystemUnits()))
|
||||||
.high(Profile.toMgdl(hypoTT, ProfileFunctions.getSystemUnits()))
|
.high(Profile.toMgdl(hypoTT, ProfileFunctions.getSystemUnits()))
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
|
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
|
||||||
}
|
}
|
||||||
if (carbsAfterConstraints > 0) {
|
if (carbsAfterConstraints > 0) {
|
||||||
|
|
|
@ -16,10 +16,14 @@ import info.nightscout.androidaps.db.CareportalEvent
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.SP
|
||||||
|
import info.nightscout.androidaps.utils.Translator
|
||||||
import kotlinx.android.synthetic.main.dialog_care.*
|
import kotlinx.android.synthetic.main.dialog_care.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
|
||||||
import kotlinx.android.synthetic.main.notes.*
|
import kotlinx.android.synthetic.main.notes.*
|
||||||
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -49,7 +53,7 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_care, container, false)
|
return inflater.inflate(R.layout.dialog_care, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,13 +61,13 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
actions_care_icon.setImageResource(when (options) {
|
actions_care_icon.setImageResource(when (options) {
|
||||||
EventType.BGCHECK -> R.drawable.icon_cp_bgcheck
|
EventType.BGCHECK -> R.drawable.icon_cp_bgcheck
|
||||||
EventType.SENSOR_INSERT -> R.drawable.icon_cp_cgm_insert
|
EventType.SENSOR_INSERT -> R.drawable.icon_cp_cgm_insert
|
||||||
EventType.BATTERY_CHANGE -> R.drawable.icon_cp_pump_battery
|
EventType.BATTERY_CHANGE -> R.drawable.icon_cp_pump_battery
|
||||||
})
|
})
|
||||||
actions_care_title.text = MainApp.gs(when (options) {
|
actions_care_title.text = MainApp.gs(when (options) {
|
||||||
EventType.BGCHECK -> R.string.careportal_bgcheck
|
EventType.BGCHECK -> R.string.careportal_bgcheck
|
||||||
EventType.SENSOR_INSERT -> R.string.careportal_cgmsensorinsert
|
EventType.SENSOR_INSERT -> R.string.careportal_cgmsensorinsert
|
||||||
EventType.BATTERY_CHANGE -> R.string.careportal_pumpbatterychange
|
EventType.BATTERY_CHANGE -> R.string.careportal_pumpbatterychange
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -73,12 +77,13 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
action_care_bg_layout.visibility = View.GONE
|
action_care_bg_layout.visibility = View.GONE
|
||||||
actions_care_bgsource.visibility = View.GONE
|
actions_care_bgsource.visibility = View.GONE
|
||||||
}
|
}
|
||||||
else -> {
|
|
||||||
|
else -> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val bg = Profile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData()?.glucose
|
val bg = Profile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData()?.glucose
|
||||||
?: 0.0, ProfileFunctions.getSystemUnits())
|
?: 0.0, ProfileFunctions.getSystemUnits())
|
||||||
val bgTextWatcher: TextWatcher = object : TextWatcher {
|
val bgTextWatcher: TextWatcher = object : TextWatcher {
|
||||||
override fun afterTextChanged(s: Editable) {}
|
override fun afterTextChanged(s: Editable) {}
|
||||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||||
|
@ -89,10 +94,10 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
if (ProfileFunctions.getSystemUnits() == Constants.MMOL)
|
if (ProfileFunctions.getSystemUnits() == Constants.MMOL)
|
||||||
actions_care_bg.setParams(savedInstanceState?.getDouble("actions_care_bg")
|
actions_care_bg.setParams(savedInstanceState?.getDouble("actions_care_bg")
|
||||||
?: bg, 36.0, 30.0, 0.1, DecimalFormat("0.0"), false, ok, bgTextWatcher)
|
?: bg, 36.0, 30.0, 0.1, DecimalFormat("0.0"), false, ok, bgTextWatcher)
|
||||||
else
|
else
|
||||||
actions_care_bg.setParams(savedInstanceState?.getDouble("actions_care_bg")
|
actions_care_bg.setParams(savedInstanceState?.getDouble("actions_care_bg")
|
||||||
?: bg, 2.0, 500.0, 1.0, DecimalFormat("0"), false, ok, bgTextWatcher)
|
?: bg, 2.0, 500.0, 1.0, DecimalFormat("0"), false, ok, bgTextWatcher)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit() {
|
||||||
|
@ -104,11 +109,11 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
actions.add("<b>" + MainApp.gs(event) + "</b>")
|
actions.add("<b>" + MainApp.gs(event) + "</b>")
|
||||||
if (options == EventType.BGCHECK) {
|
if (options == EventType.BGCHECK) {
|
||||||
val type =
|
val type =
|
||||||
when {
|
when {
|
||||||
actions_care_meter.isChecked -> "Finger"
|
actions_care_meter.isChecked -> "Finger"
|
||||||
actions_care_sensor.isChecked -> "Sensor"
|
actions_care_sensor.isChecked -> "Sensor"
|
||||||
else -> "Manual"
|
else -> "Manual"
|
||||||
}
|
}
|
||||||
actions.add(MainApp.gs(R.string.careportal_newnstreatment_glucosetype) + ": " + Translator.translate(type))
|
actions.add(MainApp.gs(R.string.careportal_newnstreatment_glucosetype) + ": " + Translator.translate(type))
|
||||||
actions.add(MainApp.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(actions_care_bg.value) + " " + MainApp.gs(unitResId))
|
actions.add(MainApp.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(actions_care_bg.value) + " " + MainApp.gs(unitResId))
|
||||||
json.put("glucose", actions_care_bg.value)
|
json.put("glucose", actions_care_bg.value)
|
||||||
|
@ -124,8 +129,8 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
json.put("created_at", DateUtil.toISOString(eventTime))
|
json.put("created_at", DateUtil.toISOString(eventTime))
|
||||||
json.put("eventType", when (options) {
|
json.put("eventType", when (options) {
|
||||||
EventType.BGCHECK -> CareportalEvent.BGCHECK
|
EventType.BGCHECK -> CareportalEvent.BGCHECK
|
||||||
EventType.SENSOR_INSERT -> CareportalEvent.SENSORCHANGE
|
EventType.SENSOR_INSERT -> CareportalEvent.SENSORCHANGE
|
||||||
EventType.BATTERY_CHANGE -> CareportalEvent.PUMPBATTERYCHANGE
|
EventType.BATTERY_CHANGE -> CareportalEvent.PUMPBATTERYCHANGE
|
||||||
})
|
})
|
||||||
json.put("units", ProfileFunctions.getSystemUnits())
|
json.put("units", ProfileFunctions.getSystemUnits())
|
||||||
|
|
|
@ -12,6 +12,7 @@ import androidx.fragment.app.DialogFragment
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.SP
|
import info.nightscout.androidaps.utils.SP
|
||||||
|
import info.nightscout.androidaps.utils.toVisibility
|
||||||
import kotlinx.android.synthetic.main.datetime.*
|
import kotlinx.android.synthetic.main.datetime.*
|
||||||
import kotlinx.android.synthetic.main.notes.*
|
import kotlinx.android.synthetic.main.notes.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
|
@ -42,7 +43,7 @@ abstract class DialogFragmentWithDate : DialogFragment() {
|
||||||
savedInstanceState.putBoolean("eventTimeChanged", eventTimeChanged)
|
savedInstanceState.putBoolean("eventTimeChanged", eventTimeChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onCreateView() {
|
fun onCreateViewGeneral() {
|
||||||
dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE)
|
dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE)
|
||||||
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
|
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
|
||||||
isCancelable = true
|
isCancelable = true
|
||||||
|
@ -72,9 +73,9 @@ abstract class DialogFragmentWithDate : DialogFragment() {
|
||||||
val cal = Calendar.getInstance()
|
val cal = Calendar.getInstance()
|
||||||
cal.timeInMillis = eventTime
|
cal.timeInMillis = eventTime
|
||||||
DatePickerDialog(it, dateSetListener,
|
DatePickerDialog(it, dateSetListener,
|
||||||
cal.get(Calendar.YEAR),
|
cal.get(Calendar.YEAR),
|
||||||
cal.get(Calendar.MONTH),
|
cal.get(Calendar.MONTH),
|
||||||
cal.get(Calendar.DAY_OF_MONTH)
|
cal.get(Calendar.DAY_OF_MONTH)
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,14 +97,14 @@ abstract class DialogFragmentWithDate : DialogFragment() {
|
||||||
val cal = Calendar.getInstance()
|
val cal = Calendar.getInstance()
|
||||||
cal.timeInMillis = eventTime
|
cal.timeInMillis = eventTime
|
||||||
TimePickerDialog(it, timeSetListener,
|
TimePickerDialog(it, timeSetListener,
|
||||||
cal.get(Calendar.HOUR_OF_DAY),
|
cal.get(Calendar.HOUR_OF_DAY),
|
||||||
cal.get(Calendar.MINUTE),
|
cal.get(Calendar.MINUTE),
|
||||||
DateFormat.is24HourFormat(context)
|
DateFormat.is24HourFormat(context)
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notes_layout?.visibility = if (SP.getBoolean(R.string.key_show_notes_entry_dialogs, false)) View.VISIBLE else View.GONE
|
notes_layout?.visibility = SP.getBoolean(R.string.key_show_notes_entry_dialogs, false).toVisibility()
|
||||||
|
|
||||||
ok.setOnClickListener {
|
ok.setOnClickListener {
|
||||||
synchronized(okClicked) {
|
synchronized(okClicked) {
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package info.nightscout.androidaps.dialogs
|
package info.nightscout.androidaps.dialogs
|
||||||
|
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.*
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.Window
|
||||||
|
import android.view.WindowManager
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
@ -87,5 +90,5 @@ class ErrorDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun stopAlarm() =
|
private fun stopAlarm() =
|
||||||
MainApp.instance().stopService(Intent(MainApp.instance().applicationContext, AlarmSoundService::class.java))
|
MainApp.instance().stopService(Intent(MainApp.instance().applicationContext, AlarmSoundService::class.java))
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.OKDialog
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
|
@ -31,7 +31,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_extendedbolus, container, false)
|
return inflater.inflate(R.layout.dialog_extendedbolus, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,12 +43,12 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
val maxInsulin = MainApp.getConstraintChecker().maxExtendedBolusAllowed.value()
|
val maxInsulin = MainApp.getConstraintChecker().maxExtendedBolusAllowed.value()
|
||||||
val extendedStep = pumpDescription.extendedBolusStep
|
val extendedStep = pumpDescription.extendedBolusStep
|
||||||
actions_extendedbolus_insulin.setParams(savedInstanceState?.getDouble("actions_extendedbolus_insulin")
|
actions_extendedbolus_insulin.setParams(savedInstanceState?.getDouble("actions_extendedbolus_insulin")
|
||||||
?: extendedStep, extendedStep, maxInsulin, extendedStep, DecimalFormat("0.00"), false, ok)
|
?: extendedStep, extendedStep, maxInsulin, extendedStep, DecimalFormat("0.00"), false, ok)
|
||||||
|
|
||||||
val extendedDurationStep = pumpDescription.extendedBolusDurationStep
|
val extendedDurationStep = pumpDescription.extendedBolusDurationStep
|
||||||
val extendedMaxDuration = pumpDescription.extendedBolusMaxDuration
|
val extendedMaxDuration = pumpDescription.extendedBolusMaxDuration
|
||||||
actions_extendedbolus_duration.setParams(savedInstanceState?.getDouble("actions_extendedbolus_duration")
|
actions_extendedbolus_duration.setParams(savedInstanceState?.getDouble("actions_extendedbolus_duration")
|
||||||
?: extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, DecimalFormat("0"), false, ok)
|
?: extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, DecimalFormat("0"), false, ok)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit() {
|
||||||
|
|
|
@ -8,13 +8,13 @@ import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.db.CareportalEvent
|
import info.nightscout.androidaps.db.CareportalEvent
|
||||||
import info.nightscout.androidaps.db.Source
|
import info.nightscout.androidaps.db.Source
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.*
|
||||||
import kotlinx.android.synthetic.main.dialog_fill.*
|
import kotlinx.android.synthetic.main.dialog_fill.*
|
||||||
|
@ -32,7 +32,7 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_fill, container, false)
|
return inflater.inflate(R.layout.dialog_fill, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
val maxInsulin = MainApp.getConstraintChecker().maxBolusAllowed.value()
|
val maxInsulin = MainApp.getConstraintChecker().maxBolusAllowed.value()
|
||||||
val bolusStep = ConfigBuilderPlugin.getPlugin().activePump!!.pumpDescription.bolusStep
|
val bolusStep = ConfigBuilderPlugin.getPlugin().activePump!!.pumpDescription.bolusStep
|
||||||
fill_insulinamount.setParams(savedInstanceState?.getDouble("fill_insulinamount")
|
fill_insulinamount.setParams(savedInstanceState?.getDouble("fill_insulinamount")
|
||||||
?: 0.0, 0.0, maxInsulin, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), true, ok)
|
?: 0.0, 0.0, maxInsulin, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), true, ok)
|
||||||
val amount1 = SP.getDouble("fill_button1", 0.3)
|
val amount1 = SP.getDouble("fill_button1", 0.3)
|
||||||
if (amount1 > 0) {
|
if (amount1 > 0) {
|
||||||
fill_preset_button1.visibility = View.VISIBLE
|
fill_preset_button1.visibility = View.VISIBLE
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.data.Profile
|
import info.nightscout.androidaps.data.Profile
|
||||||
import info.nightscout.androidaps.db.CareportalEvent
|
import info.nightscout.androidaps.db.CareportalEvent
|
||||||
|
@ -19,13 +20,12 @@ import info.nightscout.androidaps.db.TempTarget
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.*
|
||||||
|
import kotlinx.android.synthetic.main.dialog_insulin.*
|
||||||
import kotlinx.android.synthetic.main.notes.*
|
import kotlinx.android.synthetic.main.notes.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import kotlinx.android.synthetic.main.dialog_insulin.*
|
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
@ -69,7 +69,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_insulin, container, false)
|
return inflater.inflate(R.layout.dialog_insulin, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,32 +77,32 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
overview_insulin_time.setParams(savedInstanceState?.getDouble("overview_insulin_time")
|
overview_insulin_time.setParams(savedInstanceState?.getDouble("overview_insulin_time")
|
||||||
?: 0.0, -12 * 60.0, 12 * 60.0, 5.0, DecimalFormat("0"), false, ok, textWatcher)
|
?: 0.0, -12 * 60.0, 12 * 60.0, 5.0, DecimalFormat("0"), false, ok, textWatcher)
|
||||||
overview_insulin_amount.setParams(savedInstanceState?.getDouble("overview_insulin_amount")
|
overview_insulin_amount.setParams(savedInstanceState?.getDouble("overview_insulin_amount")
|
||||||
?: 0.0, 0.0, maxInsulin, ConfigBuilderPlugin.getPlugin().activePump!!.pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, ok, textWatcher)
|
?: 0.0, 0.0, maxInsulin, ConfigBuilderPlugin.getPlugin().activePump!!.pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, ok, textWatcher)
|
||||||
|
|
||||||
overview_insulin_plus05.text = toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT))
|
overview_insulin_plus05.text = toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT))
|
||||||
overview_insulin_plus05.setOnClickListener {
|
overview_insulin_plus05.setOnClickListener {
|
||||||
overview_insulin_amount.value = max(0.0, overview_insulin_amount.value
|
overview_insulin_amount.value = max(0.0, overview_insulin_amount.value
|
||||||
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT))
|
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT))
|
||||||
validateInputs()
|
validateInputs()
|
||||||
}
|
}
|
||||||
overview_insulin_plus10.text = toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT))
|
overview_insulin_plus10.text = toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT))
|
||||||
overview_insulin_plus10.setOnClickListener {
|
overview_insulin_plus10.setOnClickListener {
|
||||||
overview_insulin_amount.value = max(0.0, overview_insulin_amount.value
|
overview_insulin_amount.value = max(0.0, overview_insulin_amount.value
|
||||||
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT))
|
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT))
|
||||||
validateInputs()
|
validateInputs()
|
||||||
}
|
}
|
||||||
overview_insulin_plus20.text = toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT))
|
overview_insulin_plus20.text = toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT))
|
||||||
overview_insulin_plus20.setOnClickListener {
|
overview_insulin_plus20.setOnClickListener {
|
||||||
overview_insulin_amount.value = Math.max(0.0, overview_insulin_amount.value
|
overview_insulin_amount.value = Math.max(0.0, overview_insulin_amount.value
|
||||||
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT))
|
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT))
|
||||||
validateInputs()
|
validateInputs()
|
||||||
}
|
}
|
||||||
|
|
||||||
overview_insulin_time_layout.visibility = View.GONE
|
overview_insulin_time_layout.visibility = View.GONE
|
||||||
overview_insulin_record_only.setOnCheckedChangeListener { _, isChecked: Boolean ->
|
overview_insulin_record_only.setOnCheckedChangeListener { _, isChecked: Boolean ->
|
||||||
overview_insulin_time_layout.visibility = if (isChecked) View.VISIBLE else View.GONE
|
overview_insulin_time_layout.visibility = isChecked.toVisibility()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,12 +147,12 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
OKDialog.showConfirmation(activity, HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions))) {
|
OKDialog.showConfirmation(activity, HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions))) {
|
||||||
if (eatingSoonChecked) {
|
if (eatingSoonChecked) {
|
||||||
val tempTarget = TempTarget()
|
val tempTarget = TempTarget()
|
||||||
.date(System.currentTimeMillis())
|
.date(System.currentTimeMillis())
|
||||||
.duration(eatingSoonTTDuration)
|
.duration(eatingSoonTTDuration)
|
||||||
.reason(MainApp.gs(R.string.eatingsoon))
|
.reason(MainApp.gs(R.string.eatingsoon))
|
||||||
.source(Source.USER)
|
.source(Source.USER)
|
||||||
.low(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
|
.low(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
|
||||||
.high(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
|
.high(Profile.toMgdl(eatingSoonTT, ProfileFunctions.getSystemUnits()))
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
|
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
|
||||||
}
|
}
|
||||||
if (insulinAfterConstraints > 0) {
|
if (insulinAfterConstraints > 0) {
|
||||||
|
|
|
@ -15,9 +15,9 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.OKDialog
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
|
import kotlinx.android.synthetic.main.dialog_profileswitch.*
|
||||||
import kotlinx.android.synthetic.main.notes.*
|
import kotlinx.android.synthetic.main.notes.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import kotlinx.android.synthetic.main.dialog_profileswitch.*
|
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_profileswitch, container, false)
|
return inflater.inflate(R.layout.dialog_profileswitch, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,16 +40,16 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
overview_profileswitch_duration.setParams(savedInstanceState?.getDouble("overview_profileswitch_duration")
|
overview_profileswitch_duration.setParams(savedInstanceState?.getDouble("overview_profileswitch_duration")
|
||||||
?: 0.0, 0.0, Constants.MAX_PROFILE_SWITCH_DURATION, 10.0, DecimalFormat("0"), false, ok)
|
?: 0.0, 0.0, Constants.MAX_PROFILE_SWITCH_DURATION, 10.0, DecimalFormat("0"), false, ok)
|
||||||
overview_profileswitch_percentage.setParams(savedInstanceState?.getDouble("overview_profileswitch_percentage")
|
overview_profileswitch_percentage.setParams(savedInstanceState?.getDouble("overview_profileswitch_percentage")
|
||||||
?: 100.0, Constants.CPP_MIN_PERCENTAGE.toDouble(), Constants.CPP_MAX_PERCENTAGE.toDouble(), 1.0, DecimalFormat("0"), false, ok)
|
?: 100.0, Constants.CPP_MIN_PERCENTAGE.toDouble(), Constants.CPP_MAX_PERCENTAGE.toDouble(), 1.0, DecimalFormat("0"), false, ok)
|
||||||
overview_profileswitch_timeshift.setParams(savedInstanceState?.getDouble("overview_profileswitch_timeshift")
|
overview_profileswitch_timeshift.setParams(savedInstanceState?.getDouble("overview_profileswitch_timeshift")
|
||||||
?: 0.0, Constants.CPP_MIN_TIMESHIFT.toDouble(), Constants.CPP_MAX_TIMESHIFT.toDouble(), 1.0, DecimalFormat("0"), false, ok)
|
?: 0.0, Constants.CPP_MIN_TIMESHIFT.toDouble(), Constants.CPP_MAX_TIMESHIFT.toDouble(), 1.0, DecimalFormat("0"), false, ok)
|
||||||
|
|
||||||
// profile
|
// profile
|
||||||
context?.let { context ->
|
context?.let { context ->
|
||||||
val profileStore = ConfigBuilderPlugin.getPlugin().activeProfileInterface?.profile
|
val profileStore = ConfigBuilderPlugin.getPlugin().activeProfileInterface?.profile
|
||||||
?: return
|
?: return
|
||||||
val profileList = profileStore.getProfileList()
|
val profileList = profileStore.getProfileList()
|
||||||
val adapter = ArrayAdapter(context, R.layout.spinner_centered, profileList)
|
val adapter = ArrayAdapter(context, R.layout.spinner_centered, profileList)
|
||||||
overview_profileswitch_profile.adapter = adapter
|
overview_profileswitch_profile.adapter = adapter
|
||||||
|
|
|
@ -8,11 +8,11 @@ import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription
|
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.OKDialog
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
|
@ -35,7 +35,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_tempbasal, container, false)
|
return inflater.inflate(R.layout.dialog_tempbasal, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,15 +49,15 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
||||||
val tempPercentStep = pumpDescription.tempPercentStep.toDouble()
|
val tempPercentStep = pumpDescription.tempPercentStep.toDouble()
|
||||||
|
|
||||||
actions_tempbasal_basalpercentinput.setParams(savedInstanceState?.getDouble("actions_tempbasal_basalpercentinput")
|
actions_tempbasal_basalpercentinput.setParams(savedInstanceState?.getDouble("actions_tempbasal_basalpercentinput")
|
||||||
?: 100.0, 0.0, maxTempPercent, tempPercentStep, DecimalFormat("0"), true, ok)
|
?: 100.0, 0.0, maxTempPercent, tempPercentStep, DecimalFormat("0"), true, ok)
|
||||||
|
|
||||||
actions_tempbasal_basalabsoluteinput.setParams(savedInstanceState?.getDouble("actions_tempbasal_basalabsoluteinput")
|
actions_tempbasal_basalabsoluteinput.setParams(savedInstanceState?.getDouble("actions_tempbasal_basalabsoluteinput")
|
||||||
?: profile.basal, 0.0, pumpDescription.maxTempAbsolute, pumpDescription.tempAbsoluteStep, DecimalFormat("0.00"), true, ok)
|
?: profile.basal, 0.0, pumpDescription.maxTempAbsolute, pumpDescription.tempAbsoluteStep, DecimalFormat("0.00"), true, ok)
|
||||||
|
|
||||||
val tempDurationStep = pumpDescription.tempDurationStep.toDouble()
|
val tempDurationStep = pumpDescription.tempDurationStep.toDouble()
|
||||||
val tempMaxDuration = pumpDescription.tempMaxDuration.toDouble()
|
val tempMaxDuration = pumpDescription.tempMaxDuration.toDouble()
|
||||||
actions_tempbasal_duration.setParams(savedInstanceState?.getDouble("actions_tempbasal_duration")
|
actions_tempbasal_duration.setParams(savedInstanceState?.getDouble("actions_tempbasal_duration")
|
||||||
?: tempDurationStep, tempDurationStep, tempMaxDuration, tempDurationStep, DecimalFormat("0"), false, ok)
|
?: tempDurationStep, tempDurationStep, tempMaxDuration, tempDurationStep, DecimalFormat("0"), false, ok)
|
||||||
|
|
||||||
isPercentPump = pumpDescription.tempBasalStyle and PumpDescription.PERCENT == PumpDescription.PERCENT
|
isPercentPump = pumpDescription.tempBasalStyle and PumpDescription.PERCENT == PumpDescription.PERCENT
|
||||||
if (isPercentPump) {
|
if (isPercentPump) {
|
||||||
|
|
|
@ -16,9 +16,13 @@ import info.nightscout.androidaps.db.Source
|
||||||
import info.nightscout.androidaps.db.TempTarget
|
import info.nightscout.androidaps.db.TempTarget
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||||
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.SP
|
||||||
import kotlinx.android.synthetic.main.dialog_temptarget.*
|
import kotlinx.android.synthetic.main.dialog_temptarget.*
|
||||||
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@ -32,7 +36,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_temptarget, container, false)
|
return inflater.inflate(R.layout.dialog_temptarget, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,29 +44,29 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
overview_temptarget_duration.setParams(savedInstanceState?.getDouble("overview_temptarget_duration")
|
overview_temptarget_duration.setParams(savedInstanceState?.getDouble("overview_temptarget_duration")
|
||||||
?: 0.0, 0.0, Constants.MAX_PROFILE_SWITCH_DURATION, 10.0, DecimalFormat("0"), false, ok)
|
?: 0.0, 0.0, Constants.MAX_PROFILE_SWITCH_DURATION, 10.0, DecimalFormat("0"), false, ok)
|
||||||
|
|
||||||
if (ProfileFunctions.getSystemUnits() == Constants.MMOL)
|
if (ProfileFunctions.getSystemUnits() == Constants.MMOL)
|
||||||
overview_temptarget_temptarget.setParams(
|
overview_temptarget_temptarget.setParams(
|
||||||
savedInstanceState?.getDouble("overview_temptarget_temptarget")
|
savedInstanceState?.getDouble("overview_temptarget_temptarget")
|
||||||
?: Constants.MIN_TT_MMOL,
|
?: Constants.MIN_TT_MMOL,
|
||||||
Constants.MIN_TT_MMOL, Constants.MAX_TT_MMOL, 0.1, DecimalFormat("0.0"), false, ok)
|
Constants.MIN_TT_MMOL, Constants.MAX_TT_MMOL, 0.1, DecimalFormat("0.0"), false, ok)
|
||||||
else
|
else
|
||||||
overview_temptarget_temptarget.setParams(
|
overview_temptarget_temptarget.setParams(
|
||||||
savedInstanceState?.getDouble("overview_temptarget_temptarget")
|
savedInstanceState?.getDouble("overview_temptarget_temptarget")
|
||||||
?: Constants.MIN_TT_MGDL,
|
?: Constants.MIN_TT_MGDL,
|
||||||
Constants.MIN_TT_MGDL, Constants.MAX_TT_MGDL, 1.0, DecimalFormat("0"), false, ok)
|
Constants.MIN_TT_MGDL, Constants.MAX_TT_MGDL, 1.0, DecimalFormat("0"), false, ok)
|
||||||
|
|
||||||
val units = ProfileFunctions.getSystemUnits()
|
val units = ProfileFunctions.getSystemUnits()
|
||||||
overview_temptarget_units.text = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
|
overview_temptarget_units.text = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
|
||||||
// temp target
|
// temp target
|
||||||
context?.let { context ->
|
context?.let { context ->
|
||||||
val reasonList: List<String> = Lists.newArrayList(
|
val reasonList: List<String> = Lists.newArrayList(
|
||||||
MainApp.gs(R.string.manual),
|
MainApp.gs(R.string.manual),
|
||||||
MainApp.gs(R.string.cancel),
|
MainApp.gs(R.string.cancel),
|
||||||
MainApp.gs(R.string.eatingsoon),
|
MainApp.gs(R.string.eatingsoon),
|
||||||
MainApp.gs(R.string.activity),
|
MainApp.gs(R.string.activity),
|
||||||
MainApp.gs(R.string.hypo)
|
MainApp.gs(R.string.hypo)
|
||||||
)
|
)
|
||||||
val adapterReason = ArrayAdapter(context, R.layout.spinner_centered, reasonList)
|
val adapterReason = ArrayAdapter(context, R.layout.spinner_centered, reasonList)
|
||||||
overview_temptarget_reason.adapter = adapterReason
|
overview_temptarget_reason.adapter = adapterReason
|
||||||
|
@ -75,19 +79,23 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
||||||
defaultDuration = DefaultValueHelper.determineEatingSoonTTDuration().toDouble()
|
defaultDuration = DefaultValueHelper.determineEatingSoonTTDuration().toDouble()
|
||||||
defaultTarget = DefaultValueHelper.determineEatingSoonTT()
|
defaultTarget = DefaultValueHelper.determineEatingSoonTT()
|
||||||
}
|
}
|
||||||
MainApp.gs(R.string.activity) -> {
|
|
||||||
|
MainApp.gs(R.string.activity) -> {
|
||||||
defaultDuration = DefaultValueHelper.determineActivityTTDuration().toDouble()
|
defaultDuration = DefaultValueHelper.determineActivityTTDuration().toDouble()
|
||||||
defaultTarget = DefaultValueHelper.determineActivityTT()
|
defaultTarget = DefaultValueHelper.determineActivityTT()
|
||||||
}
|
}
|
||||||
MainApp.gs(R.string.hypo) -> {
|
|
||||||
|
MainApp.gs(R.string.hypo) -> {
|
||||||
defaultDuration = DefaultValueHelper.determineHypoTTDuration().toDouble()
|
defaultDuration = DefaultValueHelper.determineHypoTTDuration().toDouble()
|
||||||
defaultTarget = DefaultValueHelper.determineHypoTT()
|
defaultTarget = DefaultValueHelper.determineHypoTT()
|
||||||
}
|
}
|
||||||
MainApp.gs(R.string.cancel) -> {
|
|
||||||
|
MainApp.gs(R.string.cancel) -> {
|
||||||
defaultDuration = 0.0
|
defaultDuration = 0.0
|
||||||
defaultTarget = 0.0
|
defaultTarget = 0.0
|
||||||
}
|
}
|
||||||
else -> {
|
|
||||||
|
else -> {
|
||||||
defaultDuration = overview_temptarget_duration.value
|
defaultDuration = overview_temptarget_duration.value
|
||||||
defaultTarget = overview_temptarget_temptarget.value
|
defaultTarget = overview_temptarget_temptarget.value
|
||||||
}
|
}
|
||||||
|
@ -121,19 +129,19 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
||||||
OKDialog.showConfirmation(activity, HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions))) {
|
OKDialog.showConfirmation(activity, HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions))) {
|
||||||
if (target == 0.0 || duration == 0.0) {
|
if (target == 0.0 || duration == 0.0) {
|
||||||
val tempTarget = TempTarget()
|
val tempTarget = TempTarget()
|
||||||
.date(eventTime)
|
.date(eventTime)
|
||||||
.duration(0)
|
.duration(0)
|
||||||
.low(0.0).high(0.0)
|
.low(0.0).high(0.0)
|
||||||
.source(Source.USER)
|
.source(Source.USER)
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
|
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
|
||||||
} else {
|
} else {
|
||||||
val tempTarget = TempTarget()
|
val tempTarget = TempTarget()
|
||||||
.date(eventTime)
|
.date(eventTime)
|
||||||
.duration(duration.toInt())
|
.duration(duration.toInt())
|
||||||
.reason(reason)
|
.reason(reason)
|
||||||
.source(Source.USER)
|
.source(Source.USER)
|
||||||
.low(Profile.toMgdl(target, ProfileFunctions.getSystemUnits()))
|
.low(Profile.toMgdl(target, ProfileFunctions.getSystemUnits()))
|
||||||
.high(Profile.toMgdl(target, ProfileFunctions.getSystemUnits()))
|
.high(Profile.toMgdl(target, ProfileFunctions.getSystemUnits()))
|
||||||
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
|
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
|
||||||
}
|
}
|
||||||
if (duration == 10.0) SP.putBoolean(R.string.key_objectiveusetemptarget, true)
|
if (duration == 10.0) SP.putBoolean(R.string.key_objectiveusetemptarget, true)
|
||||||
|
|
|
@ -10,17 +10,21 @@ import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.db.CareportalEvent
|
import info.nightscout.androidaps.db.CareportalEvent
|
||||||
import info.nightscout.androidaps.db.Source
|
import info.nightscout.androidaps.db.Source
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.SafeParse
|
||||||
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import kotlinx.android.synthetic.main.dialog_treatment.*
|
import kotlinx.android.synthetic.main.dialog_treatment.*
|
||||||
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
@ -56,7 +60,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_treatment, container, false)
|
return inflater.inflate(R.layout.dialog_treatment, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,9 +69,9 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
val pumpDescription = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription ?: return
|
val pumpDescription = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription ?: return
|
||||||
overview_treatment_carbs.setParams(savedInstanceState?.getDouble("overview_treatment_carbs")
|
overview_treatment_carbs.setParams(savedInstanceState?.getDouble("overview_treatment_carbs")
|
||||||
?: 0.0, 0.0, maxCarbs, 1.0, DecimalFormat("0"), false, ok, textWatcher)
|
?: 0.0, 0.0, maxCarbs, 1.0, DecimalFormat("0"), false, ok, textWatcher)
|
||||||
overview_treatment_insulin.setParams(savedInstanceState?.getDouble("overview_treatment_insulin")
|
overview_treatment_insulin.setParams(savedInstanceState?.getDouble("overview_treatment_insulin")
|
||||||
?: 0.0, 0.0, maxInsulin, pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, ok, textWatcher)
|
?: 0.0, 0.0, maxInsulin, pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, ok, textWatcher)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit() {
|
||||||
|
|
|
@ -3,7 +3,11 @@ package info.nightscout.androidaps.dialogs
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
import android.view.*
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.Window
|
||||||
|
import android.view.WindowManager
|
||||||
import android.widget.AdapterView
|
import android.widget.AdapterView
|
||||||
import android.widget.AdapterView.OnItemSelectedListener
|
import android.widget.AdapterView.OnItemSelectedListener
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
|
@ -75,22 +79,22 @@ class WizardDialog : DialogFragment() {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
loadCheckedStates()
|
loadCheckedStates()
|
||||||
processCobCheckBox()
|
processCobCheckBox()
|
||||||
treatments_wizard_sbcheckbox.visibility = if (SP.getBoolean(R.string.key_usesuperbolus, false)) View.VISIBLE else View.GONE
|
treatments_wizard_sbcheckbox.visibility = SP.getBoolean(R.string.key_usesuperbolus, false).toVisibility()
|
||||||
treatments_wizard_notes_layout.visibility = if (SP.getBoolean(R.string.key_show_notes_entry_dialogs, false)) View.VISIBLE else View.GONE
|
treatments_wizard_notes_layout.visibility = SP.getBoolean(R.string.key_show_notes_entry_dialogs, false).toVisibility()
|
||||||
|
|
||||||
val maxCarbs = MainApp.getConstraintChecker().maxCarbsAllowed.value()
|
val maxCarbs = MainApp.getConstraintChecker().maxCarbsAllowed.value()
|
||||||
val maxCorrection = MainApp.getConstraintChecker().maxBolusAllowed.value()
|
val maxCorrection = MainApp.getConstraintChecker().maxBolusAllowed.value()
|
||||||
|
|
||||||
treatments_wizard_bg_input.setParams(savedInstanceState?.getDouble("treatments_wizard_bg_input")
|
treatments_wizard_bg_input.setParams(savedInstanceState?.getDouble("treatments_wizard_bg_input")
|
||||||
?: 0.0, 0.0, 500.0, 0.1, DecimalFormat("0.0"), false, ok, textWatcher)
|
?: 0.0, 0.0, 500.0, 0.1, DecimalFormat("0.0"), false, ok, textWatcher)
|
||||||
treatments_wizard_carbs_input.setParams(savedInstanceState?.getDouble("treatments_wizard_carbs_input")
|
treatments_wizard_carbs_input.setParams(savedInstanceState?.getDouble("treatments_wizard_carbs_input")
|
||||||
?: 0.0, 0.0, maxCarbs.toDouble(), 1.0, DecimalFormat("0"), false, ok, textWatcher)
|
?: 0.0, 0.0, maxCarbs.toDouble(), 1.0, DecimalFormat("0"), false, ok, textWatcher)
|
||||||
val bolusStep = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.bolusStep
|
val bolusStep = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.bolusStep
|
||||||
?: 0.1
|
?: 0.1
|
||||||
treatments_wizard_correction_input.setParams(savedInstanceState?.getDouble("treatments_wizard_correction_input")
|
treatments_wizard_correction_input.setParams(savedInstanceState?.getDouble("treatments_wizard_correction_input")
|
||||||
?: 0.0, -maxCorrection, maxCorrection, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, ok, textWatcher)
|
?: 0.0, -maxCorrection, maxCorrection, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, ok, textWatcher)
|
||||||
treatments_wizard_carb_time_input.setParams(savedInstanceState?.getDouble("treatments_wizard_carb_time_input")
|
treatments_wizard_carb_time_input.setParams(savedInstanceState?.getDouble("treatments_wizard_carb_time_input")
|
||||||
?: 0.0, -60.0, 60.0, 5.0, DecimalFormat("0"), false, ok, textWatcher)
|
?: 0.0, -60.0, 60.0, 5.0, DecimalFormat("0"), false, ok, textWatcher)
|
||||||
initDialog()
|
initDialog()
|
||||||
|
|
||||||
treatments_wizard_percent_used.text = MainApp.gs(R.string.format_percent, SP.getInt(R.string.key_boluswizard_percentage, 100))
|
treatments_wizard_percent_used.text = MainApp.gs(R.string.format_percent, SP.getInt(R.string.key_boluswizard_percentage, 100))
|
||||||
|
@ -110,23 +114,23 @@ class WizardDialog : DialogFragment() {
|
||||||
// cancel button
|
// cancel button
|
||||||
cancel.setOnClickListener { dismiss() }
|
cancel.setOnClickListener { dismiss() }
|
||||||
// checkboxes
|
// checkboxes
|
||||||
treatments_wizard_bgcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_bgcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
treatments_wizard_ttcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_ttcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
treatments_wizard_cobcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_cobcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
treatments_wizard_basaliobcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_basaliobcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
treatments_wizard_bolusiobcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_bolusiobcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
treatments_wizard_bgtrendcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_bgtrendcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
treatments_wizard_sbcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_sbcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
|
|
||||||
val showCalc = SP.getBoolean(MainApp.gs(R.string.key_wizard_calculation_visible), false)
|
val showCalc = SP.getBoolean(MainApp.gs(R.string.key_wizard_calculation_visible), false)
|
||||||
treatments_wizard_delimiter.visibility = if (showCalc) View.VISIBLE else View.GONE
|
treatments_wizard_delimiter.visibility = showCalc.toVisibility()
|
||||||
treatments_wizard_resulttable.visibility = if (showCalc) View.VISIBLE else View.GONE
|
treatments_wizard_resulttable.visibility = showCalc.toVisibility()
|
||||||
treatments_wizard_calculationcheckbox.isChecked = showCalc
|
treatments_wizard_calculationcheckbox.isChecked = showCalc
|
||||||
treatments_wizard_calculationcheckbox.setOnCheckedChangeListener { _, isChecked ->
|
treatments_wizard_calculationcheckbox.setOnCheckedChangeListener { _, isChecked ->
|
||||||
run {
|
run {
|
||||||
SP.putBoolean(MainApp.gs(R.string.key_wizard_calculation_visible), isChecked)
|
SP.putBoolean(MainApp.gs(R.string.key_wizard_calculation_visible), isChecked)
|
||||||
treatments_wizard_delimiter.visibility = if (isChecked) View.VISIBLE else View.GONE
|
treatments_wizard_delimiter.visibility = isChecked.toVisibility()
|
||||||
treatments_wizard_resulttable.visibility = if (isChecked) View.VISIBLE else View.GONE
|
treatments_wizard_resulttable.visibility = isChecked.toVisibility()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// profile spinner
|
// profile spinner
|
||||||
|
@ -143,13 +147,13 @@ class WizardDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
// bus
|
// bus
|
||||||
disposable.add(RxBus
|
disposable.add(RxBus
|
||||||
.toObservable(EventAutosensCalculationFinished::class.java)
|
.toObservable(EventAutosensCalculationFinished::class.java)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe({
|
.subscribe({
|
||||||
activity?.runOnUiThread { calculateInsulin() }
|
activity?.runOnUiThread { calculateInsulin() }
|
||||||
}, {
|
}, {
|
||||||
FabricPrivacy.logException(it)
|
FabricPrivacy.logException(it)
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -159,7 +163,7 @@ class WizardDialog : DialogFragment() {
|
||||||
disposable.clear()
|
disposable.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCheckedChanged(buttonView: CompoundButton) {
|
private fun onCheckedChanged(buttonView: CompoundButton, ignored: Boolean) {
|
||||||
saveCheckedStates()
|
saveCheckedStates()
|
||||||
treatments_wizard_ttcheckbox.isEnabled = treatments_wizard_bgcheckbox.isChecked && TreatmentsPlugin.getPlugin().tempTargetFromHistory != null
|
treatments_wizard_ttcheckbox.isEnabled = treatments_wizard_bgcheckbox.isChecked && TreatmentsPlugin.getPlugin().tempTargetFromHistory != null
|
||||||
if (buttonView.id == treatments_wizard_cobcheckbox.id)
|
if (buttonView.id == treatments_wizard_cobcheckbox.id)
|
||||||
|
@ -207,7 +211,6 @@ class WizardDialog : DialogFragment() {
|
||||||
treatments_wizard_profile.adapter = adapter
|
treatments_wizard_profile.adapter = adapter
|
||||||
} ?: return
|
} ?: return
|
||||||
|
|
||||||
|
|
||||||
val units = ProfileFunctions.getSystemUnits()
|
val units = ProfileFunctions.getSystemUnits()
|
||||||
treatments_wizard_bgunits.text = units
|
treatments_wizard_bgunits.text = units
|
||||||
if (units == Constants.MGDL)
|
if (units == Constants.MGDL)
|
||||||
|
@ -236,7 +239,7 @@ class WizardDialog : DialogFragment() {
|
||||||
|
|
||||||
calculateInsulin()
|
calculateInsulin()
|
||||||
|
|
||||||
treatments_wizard_percent_used.visibility = if (SP.getInt(R.string.key_boluswizard_percentage, 100) != 100) View.VISIBLE else View.GONE
|
treatments_wizard_percent_used.visibility = (SP.getInt(R.string.key_boluswizard_percentage, 100) != 100).toVisibility()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun calculateInsulin() {
|
private fun calculateInsulin() {
|
||||||
|
@ -277,15 +280,15 @@ class WizardDialog : DialogFragment() {
|
||||||
val carbTime = SafeParse.stringToInt(treatments_wizard_carb_time_input.text)
|
val carbTime = SafeParse.stringToInt(treatments_wizard_carb_time_input.text)
|
||||||
|
|
||||||
wizard = BolusWizard(specificProfile, profileName, tempTarget, carbsAfterConstraint, cob, bg, correction,
|
wizard = BolusWizard(specificProfile, profileName, tempTarget, carbsAfterConstraint, cob, bg, correction,
|
||||||
SP.getInt(R.string.key_boluswizard_percentage, 100).toDouble(),
|
SP.getInt(R.string.key_boluswizard_percentage, 100).toDouble(),
|
||||||
treatments_wizard_bgcheckbox.isChecked,
|
treatments_wizard_bgcheckbox.isChecked,
|
||||||
treatments_wizard_cobcheckbox.isChecked,
|
treatments_wizard_cobcheckbox.isChecked,
|
||||||
treatments_wizard_bolusiobcheckbox.isChecked,
|
treatments_wizard_bolusiobcheckbox.isChecked,
|
||||||
treatments_wizard_basaliobcheckbox.isChecked,
|
treatments_wizard_basaliobcheckbox.isChecked,
|
||||||
treatments_wizard_sbcheckbox.isChecked,
|
treatments_wizard_sbcheckbox.isChecked,
|
||||||
treatments_wizard_ttcheckbox.isChecked,
|
treatments_wizard_ttcheckbox.isChecked,
|
||||||
treatments_wizard_bgtrendcheckbox.isChecked,
|
treatments_wizard_bgtrendcheckbox.isChecked,
|
||||||
treatment_wizard_notes.text.toString(), carbTime)
|
treatment_wizard_notes.text.toString(), carbTime)
|
||||||
|
|
||||||
wizard?.let { wizard ->
|
wizard?.let { wizard ->
|
||||||
treatments_wizard_bg.text = String.format(MainApp.gs(R.string.format_bg_isf), BgReading().value(Profile.toMgdl(bg, ProfileFunctions.getSystemUnits())).valueToUnitsToString(ProfileFunctions.getSystemUnits()), wizard.sens)
|
treatments_wizard_bg.text = String.format(MainApp.gs(R.string.format_bg_isf), BgReading().value(Profile.toMgdl(bg, ProfileFunctions.getSystemUnits())).valueToUnitsToString(ProfileFunctions.getSystemUnits()), wizard.sens)
|
||||||
|
@ -306,8 +309,8 @@ class WizardDialog : DialogFragment() {
|
||||||
// Trend
|
// Trend
|
||||||
if (treatments_wizard_bgtrendcheckbox.isChecked && wizard.glucoseStatus != null) {
|
if (treatments_wizard_bgtrendcheckbox.isChecked && wizard.glucoseStatus != null) {
|
||||||
treatments_wizard_bgtrend.text = ((if (wizard.trend > 0) "+" else "")
|
treatments_wizard_bgtrend.text = ((if (wizard.trend > 0) "+" else "")
|
||||||
+ Profile.toUnitsString(wizard.trend * 3, wizard.trend * 3 / Constants.MMOLL_TO_MGDL, ProfileFunctions.getSystemUnits())
|
+ Profile.toUnitsString(wizard.trend * 3, wizard.trend * 3 / Constants.MMOLL_TO_MGDL, ProfileFunctions.getSystemUnits())
|
||||||
+ " " + ProfileFunctions.getSystemUnits())
|
+ " " + ProfileFunctions.getSystemUnits())
|
||||||
} else {
|
} else {
|
||||||
treatments_wizard_bgtrend.text = ""
|
treatments_wizard_bgtrend.text = ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,11 @@ package info.nightscout.androidaps.plugins.configBuilder
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.*
|
import android.widget.CheckBox
|
||||||
|
import android.widget.ImageButton
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.RadioButton
|
||||||
|
import android.widget.TextView
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.PreferencesActivity
|
import info.nightscout.androidaps.activities.PreferencesActivity
|
||||||
import info.nightscout.androidaps.events.EventRebuildTabs
|
import info.nightscout.androidaps.events.EventRebuildTabs
|
||||||
|
@ -10,6 +14,7 @@ import info.nightscout.androidaps.interfaces.PluginBase
|
||||||
import info.nightscout.androidaps.interfaces.PluginType
|
import info.nightscout.androidaps.interfaces.PluginType
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.utils.PasswordProtection
|
import info.nightscout.androidaps.utils.PasswordProtection
|
||||||
|
import info.nightscout.androidaps.utils.toVisibility
|
||||||
|
|
||||||
class PluginViewHolder internal constructor(private val fragment: ConfigBuilderFragment,
|
class PluginViewHolder internal constructor(private val fragment: ConfigBuilderFragment,
|
||||||
private val pluginType: PluginType,
|
private val pluginType: PluginType,
|
||||||
|
@ -56,8 +61,8 @@ class PluginViewHolder internal constructor(private val fragment: ConfigBuilderF
|
||||||
}
|
}
|
||||||
|
|
||||||
fun update() {
|
fun update() {
|
||||||
enabledExclusive.visibility = if (areMultipleSelectionsAllowed(pluginType)) View.GONE else View.VISIBLE
|
enabledExclusive.visibility = areMultipleSelectionsAllowed(pluginType).not().toVisibility()
|
||||||
enabledInclusive.visibility = if (areMultipleSelectionsAllowed(pluginType)) View.VISIBLE else View.GONE
|
enabledInclusive.visibility = areMultipleSelectionsAllowed(pluginType).toVisibility()
|
||||||
enabledExclusive.isChecked = plugin.isEnabled(pluginType)
|
enabledExclusive.isChecked = plugin.isEnabled(pluginType)
|
||||||
enabledInclusive.isChecked = plugin.isEnabled(pluginType)
|
enabledInclusive.isChecked = plugin.isEnabled(pluginType)
|
||||||
enabledInclusive.isEnabled = !plugin.pluginDescription.alwaysEnabled
|
enabledInclusive.isEnabled = !plugin.pluginDescription.alwaysEnabled
|
||||||
|
@ -70,7 +75,7 @@ class PluginViewHolder internal constructor(private val fragment: ConfigBuilderF
|
||||||
pluginDescription.text = plugin.description
|
pluginDescription.text = plugin.description
|
||||||
}
|
}
|
||||||
pluginPreferences.visibility = if (plugin.preferencesId == -1 || !plugin.isEnabled(pluginType)) View.INVISIBLE else View.VISIBLE
|
pluginPreferences.visibility = if (plugin.preferencesId == -1 || !plugin.isEnabled(pluginType)) View.INVISIBLE else View.VISIBLE
|
||||||
pluginVisibility.visibility = if (plugin.hasFragment()) View.VISIBLE else View.INVISIBLE
|
pluginVisibility.visibility = plugin.hasFragment().toVisibility()
|
||||||
pluginVisibility.isEnabled = !(plugin.pluginDescription.neverVisible || plugin.pluginDescription.alwaysVisible) && plugin.isEnabled(pluginType)
|
pluginVisibility.isEnabled = !(plugin.pluginDescription.neverVisible || plugin.pluginDescription.alwaysVisible) && plugin.isEnabled(pluginType)
|
||||||
pluginVisibility.isChecked = plugin.isFragmentVisible
|
pluginVisibility.isChecked = plugin.isFragmentVisible
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.SP
|
import info.nightscout.androidaps.utils.SP
|
||||||
import info.nightscout.androidaps.utils.SingleClickButton
|
import info.nightscout.androidaps.utils.SingleClickButton
|
||||||
import info.nightscout.androidaps.utils.plusAssign
|
import info.nightscout.androidaps.utils.plusAssign
|
||||||
|
import info.nightscout.androidaps.utils.toVisibility
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
import kotlinx.android.synthetic.main.actions_fragment.*
|
import kotlinx.android.synthetic.main.actions_fragment.*
|
||||||
|
@ -205,8 +206,8 @@ class ActionsFragment : Fragment() {
|
||||||
if (!pump.pumpDescription.isRefillingCapable || !pump.isInitialized || pump.isSuspended) View.GONE
|
if (!pump.pumpDescription.isRefillingCapable || !pump.isInitialized || pump.isSuspended) View.GONE
|
||||||
else View.VISIBLE
|
else View.VISIBLE
|
||||||
|
|
||||||
actions_temptarget?.visibility = if (!Config.APS) View.GONE else View.VISIBLE
|
actions_temptarget?.visibility = Config.APS.toVisibility()
|
||||||
actions_tddstats?.visibility = if (!pump.pumpDescription.supportsTDDs) View.GONE else View.VISIBLE
|
actions_tddstats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
CareportalFragment.updateAge(activity, careportal_sensorage, careportal_insulinage, careportal_canulaage, careportal_pbage)
|
CareportalFragment.updateAge(activity, careportal_sensorage, careportal_insulinage, careportal_canulaage, careportal_pbage)
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,15 +79,15 @@ class TreatmentsProfileSwitchFragment : Fragment() {
|
||||||
fun updateGUI() =
|
fun updateGUI() =
|
||||||
profileswitch_recyclerview?.swapAdapter(RecyclerProfileViewAdapter(MainApp.getDbHelper().getProfileSwitchData(DateUtil.now() - T.days(30).msecs(),false)), false)
|
profileswitch_recyclerview?.swapAdapter(RecyclerProfileViewAdapter(MainApp.getDbHelper().getProfileSwitchData(DateUtil.now() - T.days(30).msecs(),false)), false)
|
||||||
|
|
||||||
inner class RecyclerProfileViewAdapter(var profileSwitchList: List<ProfileSwitch>) : RecyclerView.Adapter<ProfileSwitchViewHolder>() {
|
inner class RecyclerProfileViewAdapter(private var profileSwitchList: List<ProfileSwitch>) : RecyclerView.Adapter<ProfileSwitchViewHolder>() {
|
||||||
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ProfileSwitchViewHolder {
|
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ProfileSwitchViewHolder {
|
||||||
return ProfileSwitchViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.treatments_profileswitch_item, viewGroup, false))
|
return ProfileSwitchViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.treatments_profileswitch_item, viewGroup, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ProfileSwitchViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ProfileSwitchViewHolder, position: Int) {
|
||||||
val profileSwitch = profileSwitchList[position]
|
val profileSwitch = profileSwitchList[position]
|
||||||
holder.ph.visibility = if (profileSwitch.source == Source.PUMP) View.VISIBLE else View.GONE
|
holder.ph.visibility = (profileSwitch.source == Source.PUMP).toVisibility()
|
||||||
holder.ns.visibility = if (NSUpload.isIdValid(profileSwitch._id)) View.VISIBLE else View.GONE
|
holder.ns.visibility = NSUpload.isIdValid(profileSwitch._id).toVisibility()
|
||||||
holder.date.text = DateUtil.dateAndTimeString(profileSwitch.date)
|
holder.date.text = DateUtil.dateAndTimeString(profileSwitch.date)
|
||||||
if (!profileSwitch.isEndingEvent) {
|
if (!profileSwitch.isEndingEvent) {
|
||||||
holder.duration.text = DecimalFormatter.to0Decimal(profileSwitch.durationInMinutes.toDouble()) + " " + MainApp.gs(R.string.unit_minute_short)
|
holder.duration.text = DecimalFormatter.to0Decimal(profileSwitch.durationInMinutes.toDouble()) + " " + MainApp.gs(R.string.unit_minute_short)
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package info.nightscout.androidaps.utils
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by adrian on 2019-12-20.
|
||||||
|
*/
|
||||||
|
|
||||||
|
fun Boolean.toVisibility() = if (this) View.VISIBLE else View.GONE
|
||||||
|
|
Loading…
Reference in a new issue