diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt
index 9d6e05f9ee..8210b551ee 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt
@@ -9,7 +9,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.Profile
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.databinding.DialogCalibrationBinding
@@ -81,7 +81,7 @@ class CalibrationDialog : DialogFragmentWithDate() {
if (bg > 0) {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_calibration), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
- uel.log(Action.CALIBRATION, Sources.CalibrationDialog, XXXValueWithUnit.fromGlucoseUnit(bg, units))
+ uel.log(Action.CALIBRATION, Sources.CalibrationDialog, ValueWithUnit.fromGlucoseUnit(bg, units))
xdripCalibrations.sendIntent(bg)
})
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt
index dac9893685..106f0a650b 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt
@@ -14,7 +14,7 @@ import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
@@ -225,9 +225,9 @@ class CarbsDialog : DialogFragmentWithDate() {
when {
activitySelected -> {
uel.log(Action.TT, Sources.CarbDialog,
- XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.ACTIVITY),
- XXXValueWithUnit.fromGlucoseUnit(activityTT, units) ,
- XXXValueWithUnit.Minute(activityTTDuration))
+ ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.ACTIVITY),
+ ValueWithUnit.fromGlucoseUnit(activityTT, units) ,
+ ValueWithUnit.Minute(activityTTDuration))
disposable += repository.runTransactionForResult(InsertTemporaryTargetAndCancelCurrentTransaction(
timestamp = System.currentTimeMillis(),
duration = TimeUnit.MINUTES.toMillis(activityTTDuration.toLong()),
@@ -244,9 +244,9 @@ class CarbsDialog : DialogFragmentWithDate() {
eatingSoonSelected -> {
uel.log(Action.TT, Sources.CarbDialog,
- XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON),
- XXXValueWithUnit.fromGlucoseUnit(eatingSoonTT, units) ,
- XXXValueWithUnit.Minute(eatingSoonTTDuration))
+ ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON),
+ ValueWithUnit.fromGlucoseUnit(eatingSoonTT, units) ,
+ ValueWithUnit.Minute(eatingSoonTTDuration))
disposable += repository.runTransactionForResult(InsertTemporaryTargetAndCancelCurrentTransaction(
timestamp = System.currentTimeMillis(),
duration = TimeUnit.MINUTES.toMillis(eatingSoonTTDuration.toLong()),
@@ -263,9 +263,9 @@ class CarbsDialog : DialogFragmentWithDate() {
hypoSelected -> {
uel.log(Action.TT, Sources.CarbDialog,
- XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.HYPOGLYCEMIA),
- XXXValueWithUnit.fromGlucoseUnit(hypoTT, units) ,
- XXXValueWithUnit.Minute(hypoTTDuration))
+ ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.HYPOGLYCEMIA),
+ ValueWithUnit.fromGlucoseUnit(hypoTT, units) ,
+ ValueWithUnit.Minute(hypoTTDuration))
disposable += repository.runTransactionForResult(InsertTemporaryTargetAndCancelCurrentTransaction(
timestamp = System.currentTimeMillis(),
duration = TimeUnit.MINUTES.toMillis(hypoTTDuration.toLong()),
@@ -290,10 +290,10 @@ class CarbsDialog : DialogFragmentWithDate() {
detailedBolusInfo.carbsTimestamp = time
uel.log(if (duration == 0) Action.CARBS else Action.EXTENDED_CARBS, Sources.CarbDialog,
notes,
- XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged },
- XXXValueWithUnit.Gram(carbsAfterConstraints),
- XXXValueWithUnit.Minute(timeOffset).takeIf { timeOffset != 0 },
- XXXValueWithUnit.Hour(duration).takeIf { duration != 0 })
+ ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged },
+ ValueWithUnit.Gram(carbsAfterConstraints),
+ ValueWithUnit.Minute(timeOffset).takeIf { timeOffset != 0 },
+ ValueWithUnit.Hour(duration).takeIf { duration != 0 })
commandQueue.bolus(detailedBolusInfo, object : Callback() {
override fun run() {
if (!result.success) {
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt
index b00b88d62c..28b5b070c7 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt
@@ -14,7 +14,7 @@ import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
@@ -61,7 +61,7 @@ class CareDialog : DialogFragmentWithDate() {
private var options: EventType = EventType.BGCHECK
//private var valuesWithUnit = mutableListOf()
- private var valuesWithUnit = mutableListOf()
+ private var valuesWithUnit = mutableListOf()
@StringRes
private var event: Int = R.string.none
@@ -203,13 +203,13 @@ class CareDialog : DialogFragmentWithDate() {
actions.add(resourceHelper.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(profileFunction, binding.bg.value) + " " + resourceHelper.gs(unitResId))
therapyEvent.glucoseType = meterType
therapyEvent.glucose = binding.bg.value
- valuesWithUnit.add(XXXValueWithUnit.fromGlucoseUnit(binding.bg.value.toDouble(), profileFunction.getUnits()))
- valuesWithUnit.add(XXXValueWithUnit.TherapyEventMeterType(meterType))
+ valuesWithUnit.add(ValueWithUnit.fromGlucoseUnit(binding.bg.value.toDouble(), profileFunction.getUnits()))
+ valuesWithUnit.add(ValueWithUnit.TherapyEventMeterType(meterType))
}
if (options == EventType.NOTE || options == EventType.EXERCISE) {
actions.add(resourceHelper.gs(R.string.careportal_newnstreatment_duration_label) + ": " + resourceHelper.gs(R.string.format_mins, binding.duration.value.toInt()))
therapyEvent.duration = T.mins(binding.duration.value.toLong()).msecs()
- valuesWithUnit.add(XXXValueWithUnit.Minute(binding.duration.value.toInt()).takeIf { !binding.duration.value.equals(0.0) } )
+ valuesWithUnit.add(ValueWithUnit.Minute(binding.duration.value.toInt()).takeIf { !binding.duration.value.equals(0.0) } )
}
val notes = binding.notesLayout.notes.text.toString()
if (notes.isNotEmpty()) {
@@ -238,8 +238,8 @@ class CareDialog : DialogFragmentWithDate() {
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted therapy event $it") } },
{ aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", it) }
)
- valuesWithUnit.add(0, XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged })
- valuesWithUnit.add(1, XXXValueWithUnit.TherapyEventType(therapyEvent.type))
+ valuesWithUnit.add(0, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged })
+ valuesWithUnit.add(1, ValueWithUnit.TherapyEventType(therapyEvent.type))
uel.log(Action.CAREPORTAL, source, notes, valuesWithUnit)
}, null)
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
index a226cbd5a0..c22afe0e54 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
@@ -8,7 +8,7 @@ import android.view.ViewGroup
import com.google.common.base.Joiner
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.ErrorHelperActivity
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.databinding.DialogExtendedbolusBinding
@@ -91,8 +91,8 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
uel.log(Action.EXTENDED_BOLUS, Sources.ExtendedBolusDialog,
- XXXValueWithUnit.Insulin(insulinAfterConstraint),
- XXXValueWithUnit.Minute(durationInMinutes))
+ ValueWithUnit.Insulin(insulinAfterConstraint),
+ ValueWithUnit.Minute(durationInMinutes))
commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
override fun run() {
if (!result.success) {
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
index dcff75f07a..6dc813c72e 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
@@ -10,7 +10,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
@@ -137,13 +137,13 @@ class FillDialog : DialogFragmentWithDate() {
if (insulinAfterConstraints > 0) {
uel.log(Action.PRIME_BOLUS, Sources.FillDialog,
notes,
- XXXValueWithUnit.Insulin(insulinAfterConstraints).takeIf { insulinAfterConstraints != 0.0 })
+ ValueWithUnit.Insulin(insulinAfterConstraints).takeIf { insulinAfterConstraints != 0.0 })
requestPrimeBolus(insulinAfterConstraints, notes)
}
if (siteChange) {
uel.log(Action.CAREPORTAL, Sources.FillDialog,
notes,
- XXXValueWithUnit.TherapyEventType(TherapyEvent.Type.CANNULA_CHANGE))
+ ValueWithUnit.TherapyEventType(TherapyEvent.Type.CANNULA_CHANGE))
disposable += repository.runTransactionForResult(InsertIfNewByTimestampTherapyEventTransaction(
timestamp = eventTime,
type = TherapyEvent.Type.CANNULA_CHANGE,
@@ -158,7 +158,7 @@ class FillDialog : DialogFragmentWithDate() {
// add a second for case of both checked
uel.log(Action.CAREPORTAL, Sources.FillDialog,
notes,
- XXXValueWithUnit.TherapyEventType(TherapyEvent.Type.INSULIN_CHANGE))
+ ValueWithUnit.TherapyEventType(TherapyEvent.Type.INSULIN_CHANGE))
disposable += repository.runTransactionForResult(InsertIfNewByTimestampTherapyEventTransaction(
timestamp = eventTime + 1000,
type = TherapyEvent.Type.INSULIN_CHANGE,
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
index efb7bd1759..f58cb101b7 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
@@ -15,7 +15,7 @@ import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
@@ -191,9 +191,9 @@ class InsulinDialog : DialogFragmentWithDate() {
if (eatingSoonChecked) {
uel.log(Action.TT, Sources.InsulinDialog,
notes,
- XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON),
- XXXValueWithUnit.fromGlucoseUnit(eatingSoonTT, units),
- XXXValueWithUnit.Minute(eatingSoonTTDuration))
+ ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON),
+ ValueWithUnit.fromGlucoseUnit(eatingSoonTT, units),
+ ValueWithUnit.Minute(eatingSoonTTDuration))
disposable += repository.runTransactionForResult(InsertTemporaryTargetAndCancelCurrentTransaction(
timestamp = System.currentTimeMillis(),
duration = TimeUnit.MINUTES.toMillis(eatingSoonTTDuration.toLong()),
@@ -217,9 +217,9 @@ class InsulinDialog : DialogFragmentWithDate() {
if (recordOnlyChecked) {
uel.log(Action.BOLUS, Sources.InsulinDialog,
notes,
- XXXValueWithUnit.StringResource(R.string.record),
- XXXValueWithUnit.Insulin(insulinAfterConstraints),
- XXXValueWithUnit.Minute(timeOffset).takeIf { timeOffset!= 0 })
+ ValueWithUnit.StringResource(R.string.record),
+ ValueWithUnit.Insulin(insulinAfterConstraints),
+ ValueWithUnit.Minute(timeOffset).takeIf { timeOffset!= 0 })
disposable += repository.runTransactionForResult(detailedBolusInfo.insertBolusTransaction())
.subscribe(
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it") } },
@@ -233,7 +233,7 @@ class InsulinDialog : DialogFragmentWithDate() {
} else
uel.log(Action.BOLUS, Sources.InsulinDialog,
notes,
- XXXValueWithUnit.Insulin(insulinAfterConstraints))
+ ValueWithUnit.Insulin(insulinAfterConstraints))
}
})
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
index 8fa17df7a4..ffe44af098 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
@@ -12,7 +12,7 @@ import androidx.fragment.app.FragmentManager
import dagger.android.support.DaggerDialogFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.ErrorHelperActivity
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.databinding.DialogLoopBinding
@@ -305,49 +305,49 @@ class LoopDialog : DaggerDialogFragment() {
}
R.id.overview_suspend_1h -> {
- uel.log(Action.SUSPEND, Sources.LoopDialog, XXXValueWithUnit.Hour(1))
+ uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(1))
loopPlugin.suspendLoop(60)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_suspend_2h -> {
- uel.log(Action.SUSPEND, Sources.LoopDialog, XXXValueWithUnit.Hour(2))
+ uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(2))
loopPlugin.suspendLoop(120)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_suspend_3h -> {
- uel.log(Action.SUSPEND, Sources.LoopDialog, XXXValueWithUnit.Hour(3))
+ uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(3))
loopPlugin.suspendLoop(180)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_suspend_10h -> {
- uel.log(Action.SUSPEND, Sources.LoopDialog, XXXValueWithUnit.Hour(10))
+ uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(10))
loopPlugin.suspendLoop(600)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_15m -> {
- uel.log(Action.DISCONNECT, Sources.LoopDialog, XXXValueWithUnit.Minute(15))
+ uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Minute(15))
loopPlugin.disconnectPump(15, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_30m -> {
- uel.log(Action.DISCONNECT, Sources.LoopDialog, XXXValueWithUnit.Minute(30))
+ uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Minute(30))
loopPlugin.disconnectPump(30, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_1h -> {
- uel.log(Action.DISCONNECT, Sources.LoopDialog, XXXValueWithUnit.Hour(1))
+ uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(1))
loopPlugin.disconnectPump(60, profile)
sp.putBoolean(R.string.key_objectiveusedisconnect, true)
rxBus.send(EventRefreshOverview("suspendmenu"))
@@ -355,14 +355,14 @@ class LoopDialog : DaggerDialogFragment() {
}
R.id.overview_disconnect_2h -> {
- uel.log(Action.DISCONNECT, Sources.LoopDialog, XXXValueWithUnit.Hour(2))
+ uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(2))
loopPlugin.disconnectPump(120, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_3h -> {
- uel.log(Action.DISCONNECT, Sources.LoopDialog, XXXValueWithUnit.Hour(3))
+ uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(3))
loopPlugin.disconnectPump(180, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
index 939e373b76..3f6a7d9da4 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
@@ -8,7 +8,7 @@ import android.widget.ArrayAdapter
import com.google.common.base.Joiner
import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.databinding.DialogProfileswitchBinding
@@ -130,11 +130,11 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
uel.log(Action.PROFILE_SWITCH,
Sources.ProfileSwitchDialog,
notes,
- XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged },
- XXXValueWithUnit.SimpleString(profile),
- XXXValueWithUnit.Percent(percent),
- XXXValueWithUnit.Hour(timeShift).takeIf { timeShift != 0 },
- XXXValueWithUnit.Minute(duration).takeIf { duration != 0 })
+ ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged },
+ ValueWithUnit.SimpleString(profile),
+ ValueWithUnit.Percent(percent),
+ ValueWithUnit.Hour(timeShift).takeIf { timeShift != 0 },
+ ValueWithUnit.Minute(duration).takeIf { duration != 0 })
treatmentsPlugin.doProfileSwitch(profileStore, profile, duration, percent, timeShift, eventTime)
})
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
index 0411ba5418..22cabe2540 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
@@ -8,7 +8,7 @@ import android.view.ViewGroup
import com.google.common.base.Joiner
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.ErrorHelperActivity
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.databinding.DialogTempbasalBinding
@@ -129,13 +129,13 @@ class TempBasalDialog : DialogFragmentWithDate() {
}
if (isPercentPump) {
uel.log(Action.TEMP_BASAL, Sources.TempBasalDialog,
- XXXValueWithUnit.Percent(percent),
- XXXValueWithUnit.Minute(durationInMinutes))
+ ValueWithUnit.Percent(percent),
+ ValueWithUnit.Minute(durationInMinutes))
commandQueue.tempBasalPercent(percent, durationInMinutes, true, profile, callback)
} else {
uel.log(Action.TEMP_BASAL, Sources.TempBasalDialog,
- XXXValueWithUnit.Insulin(absolute),
- XXXValueWithUnit.Minute(durationInMinutes))
+ ValueWithUnit.Insulin(absolute),
+ ValueWithUnit.Minute(durationInMinutes))
commandQueue.tempBasalAbsolute(absolute, durationInMinutes, true, profile, callback)
}
})
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
index 9d2325b061..94f4c611fa 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
@@ -12,7 +12,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
@@ -181,11 +181,11 @@ class TempTargetDialog : DialogFragmentWithDate() {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_temporarytarget), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
val units = profileFunction.getUnits()
when(reason) {
- resourceHelper.gs(R.string.eatingsoon) -> uel.log(Action.TT, Sources.TTDialog, XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON), XXXValueWithUnit.fromGlucoseUnit(target, units), XXXValueWithUnit.Minute(duration))
- resourceHelper.gs(R.string.activity) -> uel.log(Action.TT, Sources.TTDialog, XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.ACTIVITY), XXXValueWithUnit.fromGlucoseUnit(target, units), XXXValueWithUnit.Minute(duration))
- resourceHelper.gs(R.string.hypo) -> uel.log(Action.TT, Sources.TTDialog, XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.HYPOGLYCEMIA), XXXValueWithUnit.fromGlucoseUnit(target, units), XXXValueWithUnit.Minute(duration))
- resourceHelper.gs(R.string.manual) -> uel.log(Action.TT, Sources.TTDialog, XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.CUSTOM), XXXValueWithUnit.fromGlucoseUnit(target, units), XXXValueWithUnit.Minute(duration))
- resourceHelper.gs(R.string.stoptemptarget) -> uel.log(Action.CANCEL_TT, Sources.TTDialog, XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged })
+ resourceHelper.gs(R.string.eatingsoon) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON), ValueWithUnit.fromGlucoseUnit(target, units), ValueWithUnit.Minute(duration))
+ resourceHelper.gs(R.string.activity) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.ACTIVITY), ValueWithUnit.fromGlucoseUnit(target, units), ValueWithUnit.Minute(duration))
+ resourceHelper.gs(R.string.hypo) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.HYPOGLYCEMIA), ValueWithUnit.fromGlucoseUnit(target, units), ValueWithUnit.Minute(duration))
+ resourceHelper.gs(R.string.manual) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.CUSTOM), ValueWithUnit.fromGlucoseUnit(target, units), ValueWithUnit.Minute(duration))
+ resourceHelper.gs(R.string.stoptemptarget) -> uel.log(Action.CANCEL_TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged })
}
if (target == 0.0 || duration == 0) {
disposable += repository.runTransactionForResult(CancelCurrentTemporaryTargetIfAnyTransaction(eventTime))
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
index 7e94e0eced..ef426f2429 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
@@ -13,7 +13,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.databinding.DialogTreatmentBinding
@@ -152,10 +152,10 @@ class TreatmentDialog : DialogFragmentWithDate() {
detailedBolusInfo.context = context
if (recordOnlyChecked) {
uel.log(action, Sources.TreatmentDialog,
- XXXValueWithUnit.Timestamp(detailedBolusInfo.timestamp).takeIf { eventTimeChanged },
- XXXValueWithUnit.StringResource(R.string.record).takeIf { insulinAfterConstraints != 0.0 },
- XXXValueWithUnit.Insulin(insulinAfterConstraints).takeIf { insulinAfterConstraints != 0.0 },
- XXXValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbsAfterConstraints != 0 })
+ ValueWithUnit.Timestamp(detailedBolusInfo.timestamp).takeIf { eventTimeChanged },
+ ValueWithUnit.StringResource(R.string.record).takeIf { insulinAfterConstraints != 0.0 },
+ ValueWithUnit.Insulin(insulinAfterConstraints).takeIf { insulinAfterConstraints != 0.0 },
+ ValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbsAfterConstraints != 0 })
if (detailedBolusInfo.insulin > 0)
disposable += repository.runTransactionForResult(detailedBolusInfo.insertBolusTransaction())
.subscribe(
@@ -176,13 +176,13 @@ class TreatmentDialog : DialogFragmentWithDate() {
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
} else
uel.log(action, Sources.TreatmentDialog,
- XXXValueWithUnit.Insulin(insulinAfterConstraints),
- XXXValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbsAfterConstraints != 0 })
+ ValueWithUnit.Insulin(insulinAfterConstraints),
+ ValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbsAfterConstraints != 0 })
}
})
else
uel.log(action, Sources.TreatmentDialog,
- XXXValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbs != 0 })
+ ValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbs != 0 })
}
})
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt
index 4c18d06f98..12596f3f33 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt
@@ -19,7 +19,7 @@ import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction
import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
import info.nightscout.androidaps.events.EventAcceptOpenLoopChange
@@ -564,8 +564,8 @@ open class LoopPlugin @Inject constructor(
} else {
aapsLogger.debug(LTag.APS, "applyAPSRequest: tempBasalPercent()")
uel.log(Action.TEMP_BASAL, Sources.Loop,
- XXXValueWithUnit.Percent(request.percent),
- XXXValueWithUnit.Minute(request.duration))
+ ValueWithUnit.Percent(request.percent),
+ ValueWithUnit.Minute(request.duration))
commandQueue.tempBasalPercent(request.percent, request.duration, false, profile!!, callback)
}
} else {
@@ -587,8 +587,8 @@ open class LoopPlugin @Inject constructor(
} else {
aapsLogger.debug(LTag.APS, "applyAPSRequest: setTempBasalAbsolute()")
uel.log(Action.TEMP_BASAL, Sources.Loop,
- XXXValueWithUnit.UnitPerHour(request.rate),
- XXXValueWithUnit.Minute(request.duration))
+ ValueWithUnit.UnitPerHour(request.rate),
+ ValueWithUnit.Minute(request.duration))
commandQueue.tempBasalAbsolute(request.rate, request.duration, false, profile!!, callback)
}
}
@@ -628,7 +628,7 @@ open class LoopPlugin @Inject constructor(
detailedBolusInfo.deliverAtTheLatest = request.deliverAt
aapsLogger.debug(LTag.APS, "applyAPSRequest: bolus()")
if (request.smb > 0.0)
- uel.log(Action.SMB, Sources.Loop, XXXValueWithUnit.Insulin(detailedBolusInfo.insulin))
+ uel.log(Action.SMB, Sources.Loop, ValueWithUnit.Insulin(detailedBolusInfo.insulin))
commandQueue.bolus(detailedBolusInfo, callback)
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt
index 9dfc276ef4..52630816cc 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt
@@ -19,7 +19,7 @@ import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.databinding.ObjectivesFragmentBinding
import info.nightscout.androidaps.databinding.ObjectivesItemBinding
import info.nightscout.androidaps.dialogs.NtpProgressDialog
@@ -311,7 +311,7 @@ class ObjectivesFragment : DaggerFragment() {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.objectives), resourceHelper.gs(R.string.doyouwantresetstart), Runnable {
uel.log(Action.OBJECTIVE_UNSTARTED, Sources.Objectives,
- XXXValueWithUnit.SimpleInt(position + 1))
+ ValueWithUnit.SimpleInt(position + 1))
objective.startedOn = 0
scrollToCurrentObjective()
rxBus.send(EventObjectivesUpdateGui())
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt
index 1cfd0cd557..b89f9668e7 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt
@@ -1,7 +1,6 @@
package info.nightscout.androidaps.plugins.general.nsclient
import android.content.Context
-import androidx.work.Data
import androidx.work.Worker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
@@ -9,7 +8,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
@@ -92,14 +91,14 @@ class NSClientAddUpdateWorker(
.also { result ->
result.inserted.forEach {
uel.log(Action.CAREPORTAL, Sources.NSClient,
- XXXValueWithUnit.Timestamp(it.timestamp),
- XXXValueWithUnit.Insulin(it.amount)
+ ValueWithUnit.Timestamp(it.timestamp),
+ ValueWithUnit.Insulin(it.amount)
)
}
result.invalidated.forEach {
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
- XXXValueWithUnit.Timestamp(it.timestamp),
- XXXValueWithUnit.Insulin(it.amount)
+ ValueWithUnit.Timestamp(it.timestamp),
+ ValueWithUnit.Insulin(it.amount)
)
}
}
@@ -116,14 +115,14 @@ class NSClientAddUpdateWorker(
.also { result ->
result.inserted.forEach {
uel.log(Action.CAREPORTAL, Sources.NSClient,
- XXXValueWithUnit.Timestamp(it.timestamp),
- XXXValueWithUnit.Gram(it.amount.toInt())
+ ValueWithUnit.Timestamp(it.timestamp),
+ ValueWithUnit.Gram(it.amount.toInt())
)
}
result.invalidated.forEach {
uel.log(Action.CAREPORTAL, Sources.NSClient,
- XXXValueWithUnit.Timestamp(it.timestamp),
- XXXValueWithUnit.Gram(it.amount.toInt())
+ ValueWithUnit.Timestamp(it.timestamp),
+ ValueWithUnit.Gram(it.amount.toInt())
)
}
}
@@ -142,26 +141,26 @@ class NSClientAddUpdateWorker(
.also { result ->
result.inserted.forEach { tt ->
uel.log(Action.TT, Sources.NSClient,
- XXXValueWithUnit.TherapyEventTTReason(tt.reason),
- XXXValueWithUnit.fromGlucoseUnit(tt.lowTarget, Constants.MGDL),
- XXXValueWithUnit.fromGlucoseUnit(tt.highTarget, Constants.MGDL).takeIf { tt.lowTarget != tt.highTarget },
- XXXValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt.duration).toInt())
+ ValueWithUnit.TherapyEventTTReason(tt.reason),
+ ValueWithUnit.fromGlucoseUnit(tt.lowTarget, Constants.MGDL),
+ ValueWithUnit.fromGlucoseUnit(tt.highTarget, Constants.MGDL).takeIf { tt.lowTarget != tt.highTarget },
+ ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt.duration).toInt())
)
}
result.invalidated.forEach { tt ->
uel.log(Action.TT_REMOVED, Sources.NSClient,
- XXXValueWithUnit.TherapyEventTTReason(tt.reason),
- XXXValueWithUnit.Mgdl(tt.lowTarget),
- XXXValueWithUnit.Mgdl(tt.highTarget).takeIf { tt.lowTarget != tt.highTarget },
- XXXValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt.duration).toInt())
+ ValueWithUnit.TherapyEventTTReason(tt.reason),
+ ValueWithUnit.Mgdl(tt.lowTarget),
+ ValueWithUnit.Mgdl(tt.highTarget).takeIf { tt.lowTarget != tt.highTarget },
+ ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt.duration).toInt())
)
}
result.ended.forEach { tt ->
uel.log(Action.CANCEL_TT, Sources.NSClient,
- XXXValueWithUnit.TherapyEventTTReason(tt.reason),
- XXXValueWithUnit.Mgdl(tt.lowTarget),
- XXXValueWithUnit.Mgdl(tt.highTarget).takeIf { tt.lowTarget != tt.highTarget },
- XXXValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt.duration).toInt())
+ ValueWithUnit.TherapyEventTTReason(tt.reason),
+ ValueWithUnit.Mgdl(tt.lowTarget),
+ ValueWithUnit.Mgdl(tt.highTarget).takeIf { tt.lowTarget != tt.highTarget },
+ ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt.duration).toInt())
)
}
}
@@ -187,15 +186,15 @@ class NSClientAddUpdateWorker(
result.inserted.forEach {
uel.log(Action.CAREPORTAL, Sources.NSClient,
it.note ?: "",
- XXXValueWithUnit.Timestamp(it.timestamp),
- XXXValueWithUnit.TherapyEventType(it.type)
+ ValueWithUnit.Timestamp(it.timestamp),
+ ValueWithUnit.TherapyEventType(it.type)
)
}
result.invalidated.forEach {
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
it.note ?: "",
- XXXValueWithUnit.Timestamp(it.timestamp),
- XXXValueWithUnit.TherapyEventType(it.type)
+ ValueWithUnit.Timestamp(it.timestamp),
+ ValueWithUnit.TherapyEventType(it.type)
)
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientRemoveWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientRemoveWorker.kt
index a84f712599..2ca4269618 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientRemoveWorker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientRemoveWorker.kt
@@ -7,7 +7,7 @@ import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.database.transactions.SyncNsBolusTransaction
@@ -74,10 +74,10 @@ class NSClientRemoveWorker(
result.invalidated.forEach { tt ->
uel.log(
Action.TT_REMOVED, Sources.NSClient,
- XXXValueWithUnit.TherapyEventTTReason(tt.reason),
- XXXValueWithUnit.Mgdl(tt.lowTarget),
- XXXValueWithUnit.Mgdl(tt.highTarget).takeIf { tt.lowTarget != tt.highTarget },
- XXXValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt.duration).toInt()).takeIf { tt.duration != 0L }
+ ValueWithUnit.TherapyEventTTReason(tt.reason),
+ ValueWithUnit.Mgdl(tt.lowTarget),
+ ValueWithUnit.Mgdl(tt.highTarget).takeIf { tt.lowTarget != tt.highTarget },
+ ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt.duration).toInt()).takeIf { tt.duration != 0L }
)
}
}
@@ -94,8 +94,8 @@ class NSClientRemoveWorker(
result.invalidated.forEach {
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
(it.note ?: ""),
- XXXValueWithUnit.Timestamp(it.timestamp),
- XXXValueWithUnit.TherapyEventType(it.type))
+ ValueWithUnit.Timestamp(it.timestamp),
+ ValueWithUnit.TherapyEventType(it.type))
}
}
@@ -110,8 +110,8 @@ class NSClientRemoveWorker(
.also { result ->
result.invalidated.forEach {
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
- XXXValueWithUnit.Timestamp(it.timestamp),
- XXXValueWithUnit.Insulin(it.amount))
+ ValueWithUnit.Timestamp(it.timestamp),
+ ValueWithUnit.Insulin(it.amount))
}
}
@@ -126,8 +126,8 @@ class NSClientRemoveWorker(
.also { result ->
result.invalidated.forEach {
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
- XXXValueWithUnit.Timestamp(it.timestamp),
- XXXValueWithUnit.Gram(it.amount.toInt()))
+ ValueWithUnit.Timestamp(it.timestamp),
+ ValueWithUnit.Gram(it.amount.toInt()))
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
index 490bd30a18..f9c602dee3 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
@@ -17,7 +17,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
@@ -585,7 +585,7 @@ class SmsCommunicatorPlugin @Inject constructor(
val replyText = resourceHelper.gs(R.string.profileswitchcreated)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.PROFILE_SWITCH, Sources.SMS,
- XXXValueWithUnit.StringResource(R.string.profileswitchcreated))
+ ValueWithUnit.StringResource(R.string.profileswitchcreated))
}
})
}
@@ -608,13 +608,13 @@ class SmsCommunicatorPlugin @Inject constructor(
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalcanceled))
+ ValueWithUnit.StringResource(R.string.smscommunicator_tempbasalcanceled))
} else {
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalcancelfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalcancelfailed))
+ ValueWithUnit.StringResource(R.string.smscommunicator_tempbasalcancelfailed))
}
}
})
@@ -645,17 +645,17 @@ class SmsCommunicatorPlugin @Inject constructor(
if (result.isPercent)
uel.log(Action.TEMP_BASAL, Sources.SMS,
activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset_percent, listOf(XXXValueWithUnit.Percent(result.percent), XXXValueWithUnit.Minute(result.duration))) )
+ ValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset_percent, listOf(ValueWithUnit.Percent(result.percent), ValueWithUnit.Minute(result.duration))) )
else
uel.log(Action.TEMP_BASAL, Sources.SMS,
activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset, listOf( XXXValueWithUnit.UnitPerHour(result.absolute), XXXValueWithUnit.Minute(result.duration))))
+ ValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset, listOf( ValueWithUnit.UnitPerHour(result.absolute), ValueWithUnit.Minute(result.duration))))
} else {
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalfailed))
+ ValueWithUnit.StringResource(R.string.smscommunicator_tempbasalfailed))
}
}
})
@@ -687,16 +687,16 @@ class SmsCommunicatorPlugin @Inject constructor(
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
if (result.isPercent)
uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset_percent, listOf(XXXValueWithUnit.Percent(result.percent), XXXValueWithUnit.Minute(result.duration))))
+ ValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset_percent, listOf(ValueWithUnit.Percent(result.percent), ValueWithUnit.Minute(result.duration))))
else
uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset, listOf(XXXValueWithUnit.UnitPerHour(result.absolute), XXXValueWithUnit.Minute(result.duration))))
+ ValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset, listOf(ValueWithUnit.UnitPerHour(result.absolute), ValueWithUnit.Minute(result.duration))))
} else {
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalfailed))
+ ValueWithUnit.StringResource(R.string.smscommunicator_tempbasalfailed))
}
}
})
@@ -724,7 +724,7 @@ class SmsCommunicatorPlugin @Inject constructor(
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_extendedcanceled))
+ ValueWithUnit.StringResource(R.string.smscommunicator_extendedcanceled))
}
}
})
@@ -752,17 +752,17 @@ class SmsCommunicatorPlugin @Inject constructor(
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
if (config.APS)
uel.log(Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_extendedset, listOf(XXXValueWithUnit.Insulin(aDouble ?: 0.0), XXXValueWithUnit.Minute(duration))),
- XXXValueWithUnit.StringResource(R.string.loopsuspended))
+ ValueWithUnit.StringResource(R.string.smscommunicator_extendedset, listOf(ValueWithUnit.Insulin(aDouble ?: 0.0), ValueWithUnit.Minute(duration))),
+ ValueWithUnit.StringResource(R.string.loopsuspended))
else
uel.log(Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_extendedset, listOf( XXXValueWithUnit.Insulin(aDouble ?: 0.0), XXXValueWithUnit.Minute(duration))))
+ ValueWithUnit.StringResource(R.string.smscommunicator_extendedset, listOf( ValueWithUnit.Insulin(aDouble ?: 0.0), ValueWithUnit.Minute(duration))))
} else {
var replyText = resourceHelper.gs(R.string.smscommunicator_extendedfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_extendedfailed))
+ ValueWithUnit.StringResource(R.string.smscommunicator_extendedfailed))
}
}
})
@@ -840,7 +840,7 @@ class SmsCommunicatorPlugin @Inject constructor(
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_bolusfailed))
+ ValueWithUnit.StringResource(R.string.smscommunicator_bolusfailed))
}
}
})
@@ -879,13 +879,13 @@ class SmsCommunicatorPlugin @Inject constructor(
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.CARBS, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_carbsset, listOf(XXXValueWithUnit.Gram(anInteger ?: 0))))
+ ValueWithUnit.StringResource(R.string.smscommunicator_carbsset, listOf(ValueWithUnit.Gram(anInteger ?: 0))))
} else {
var replyText = resourceHelper.gs(R.string.smscommunicator_carbsfailed, anInteger)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.CARBS, Sources.SMS, activePlugin.activePump.shortStatus(true),
- XXXValueWithUnit.StringResource(R.string.smscommunicator_carbsfailed, listOf(XXXValueWithUnit.Gram(anInteger ?: 0))))
+ ValueWithUnit.StringResource(R.string.smscommunicator_carbsfailed, listOf(ValueWithUnit.Gram(anInteger ?: 0))))
}
}
})
@@ -957,8 +957,8 @@ class SmsCommunicatorPlugin @Inject constructor(
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_tt_set), ttString, ttDuration)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.TT, Sources.SMS,
- XXXValueWithUnit.fromGlucoseUnit(tt, units),
- XXXValueWithUnit.Minute(ttDuration))
+ ValueWithUnit.fromGlucoseUnit(tt, units),
+ ValueWithUnit.Minute(ttDuration))
}
})
} else if (isStop) {
@@ -976,7 +976,7 @@ class SmsCommunicatorPlugin @Inject constructor(
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_tt_canceled))
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.CANCEL_TT, Sources.SMS,
- XXXValueWithUnit.StringResource(R.string.smscommunicator_tt_canceled))
+ ValueWithUnit.StringResource(R.string.smscommunicator_tt_canceled))
}
})
} else
@@ -996,7 +996,7 @@ class SmsCommunicatorPlugin @Inject constructor(
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_stoppedsms))
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.STOP_SMS, Sources.SMS,
- XXXValueWithUnit.StringResource(R.string.smscommunicator_stoppedsms))
+ ValueWithUnit.StringResource(R.string.smscommunicator_stoppedsms))
}
})
} else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
@@ -1016,10 +1016,10 @@ class SmsCommunicatorPlugin @Inject constructor(
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
if (result)
uel.log(Action.CALIBRATION, Sources.SMS,
- XXXValueWithUnit.StringResource(R.string.smscommunicator_calibrationsent))
+ ValueWithUnit.StringResource(R.string.smscommunicator_calibrationsent))
else
uel.log(Action.CALIBRATION, Sources.SMS,
- XXXValueWithUnit.StringResource(R.string.smscommunicator_calibrationfailed))
+ ValueWithUnit.StringResource(R.string.smscommunicator_calibrationfailed))
}
})
} else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt
index 06ce86c137..329dd8fc7c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt
@@ -18,7 +18,7 @@ import info.nightscout.androidaps.database.ValueWrapper
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.interfaces.end
import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
@@ -570,8 +570,8 @@ class ActionStringHandler @Inject constructor(
}
//send profile to pump
uel.log(Action.PROFILE_SWITCH, Sources.Wear,
- XXXValueWithUnit.Percent(percentage),
- XXXValueWithUnit.Hour(timeshift).takeIf { timeshift != 0 })
+ ValueWithUnit.Percent(percentage),
+ ValueWithUnit.Hour(timeshift).takeIf { timeshift != 0 })
activePlugin.activeTreatments.doProfileSwitch(0, percentage, timeshift)
}
@@ -590,10 +590,10 @@ class ActionStringHandler @Inject constructor(
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
})
uel.log(Action.TT, Sources.Wear,
- XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.WEAR),
- XXXValueWithUnit.fromGlucoseUnit(low, profileFunction.getUnits()),
- XXXValueWithUnit.fromGlucoseUnit(high, profileFunction.getUnits()).takeIf { low != high },
- XXXValueWithUnit.Minute(duration))
+ ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.WEAR),
+ ValueWithUnit.fromGlucoseUnit(low, profileFunction.getUnits()),
+ ValueWithUnit.fromGlucoseUnit(high, profileFunction.getUnits()).takeIf { low != high },
+ ValueWithUnit.Minute(duration))
} else {
disposable += repository.runTransactionForResult(CancelCurrentTemporaryTargetIfAnyTransaction(System.currentTimeMillis()))
.subscribe({ result ->
@@ -602,7 +602,7 @@ class ActionStringHandler @Inject constructor(
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
})
uel.log(Action.CANCEL_TT, Sources.Wear,
- XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.WEAR))
+ ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.WEAR))
}
}
@@ -611,7 +611,7 @@ class ActionStringHandler @Inject constructor(
detailedBolusInfo.insulin = amount
detailedBolusInfo.bolusType = DetailedBolusInfo.BolusType.PRIMING
uel.log(Action.PRIME_BOLUS, Sources.Wear,
- XXXValueWithUnit.Insulin(amount).takeIf { amount != 0.0 })
+ ValueWithUnit.Insulin(amount).takeIf { amount != 0.0 })
commandQueue.bolus(detailedBolusInfo, object : Callback() {
override fun run() {
if (!result.success) {
@@ -625,9 +625,9 @@ class ActionStringHandler @Inject constructor(
private fun doECarbs(carbs: Int, time: Long, duration: Int) {
uel.log(if (duration==0) Action.CARBS else Action.EXTENDED_CARBS, Sources.Wear,
- XXXValueWithUnit.Timestamp(time),
- XXXValueWithUnit.Gram(carbs),
- XXXValueWithUnit.Hour(duration).takeIf { duration !=0 })
+ ValueWithUnit.Timestamp(time),
+ ValueWithUnit.Gram(carbs),
+ ValueWithUnit.Hour(duration).takeIf { duration !=0 })
doBolus(0.0, carbs, time, duration)
}
@@ -646,9 +646,9 @@ class ActionStringHandler @Inject constructor(
else -> Action.TREATMENT
}
uel.log(action, Sources.Wear,
- XXXValueWithUnit.Insulin(amount).takeIf { amount != 0.0 },
- XXXValueWithUnit.Gram(carbs).takeIf { carbs != 0 },
- XXXValueWithUnit.Hour(carbsDuration).takeIf { carbsDuration != 0 })
+ ValueWithUnit.Insulin(amount).takeIf { amount != 0.0 },
+ ValueWithUnit.Gram(carbs).takeIf { carbs != 0 },
+ ValueWithUnit.Hour(carbsDuration).takeIf { carbsDuration != 0 })
commandQueue.bolus(detailedBolusInfo, object : Callback() {
override fun run() {
if (!result.success) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt
index 1c6b833245..77cc9e37e2 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt
@@ -14,7 +14,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.databinding.LocalprofileFragmentBinding
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
import info.nightscout.androidaps.interfaces.ActivePluginProvider
@@ -175,7 +175,7 @@ class LocalProfileFragment : DaggerFragment() {
if (localProfilePlugin.isEdited) {
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
} else {
- uel.log(Action.CLONE_PROFILE, Sources.LocalProfile, XXXValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name ?: ""))
+ uel.log(Action.CLONE_PROFILE, Sources.LocalProfile, ValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name ?: ""))
localProfilePlugin.cloneProfile()
build()
}
@@ -184,7 +184,7 @@ class LocalProfileFragment : DaggerFragment() {
binding.profileRemove.setOnClickListener {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.deletecurrentprofile), {
- uel.log(Action.PROFILE_REMOVED, Sources.LocalProfile, XXXValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name ?: ""))
+ uel.log(Action.PROFILE_REMOVED, Sources.LocalProfile, ValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name ?: ""))
localProfilePlugin.removeCurrentProfile()
build()
}, null)
@@ -212,7 +212,7 @@ class LocalProfileFragment : DaggerFragment() {
if (!localProfilePlugin.isValidEditState()) {
return@setOnClickListener //Should not happen as saveButton should not be visible if not valid
}
- uel.log(Action.STORE_PROFILE, Sources.LocalProfile, XXXValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name ?: ""))
+ uel.log(Action.STORE_PROFILE, Sources.LocalProfile, ValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name ?: ""))
localProfilePlugin.storeSettings(activity)
build()
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfileFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfileFragment.kt
index f7b2a31c72..e5f6269b74 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfileFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/ns/NSProfileFragment.kt
@@ -8,7 +8,7 @@ import android.widget.AdapterView
import android.widget.ArrayAdapter
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.databinding.NsprofileFragmentBinding
@@ -65,8 +65,8 @@ class NSProfileFragment : DaggerFragment() {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.nsprofile),
resourceHelper.gs(R.string.activate_profile) + ": " + name + " ?", Runnable {
uel.log(Action.PROFILE_SWITCH, Sources.NSProfile,
- XXXValueWithUnit.SimpleString(name),
- XXXValueWithUnit.Percent(100))
+ ValueWithUnit.SimpleString(name),
+ ValueWithUnit.Percent(100))
treatmentsPlugin.doProfileSwitch(store, name, 0, 100, 0, DateUtil.now())
})
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
index 3f74df98cf..55519b90f3 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
@@ -10,7 +10,7 @@ import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.GlucoseValue
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
@@ -133,7 +133,7 @@ class BGSourceFragment : DaggerFragment() {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
//uel.log(Action.BG_REMOVED, XXXValueWithUnit.Timestamp(glucoseValue.timestamp))
uel.log(Action.BG_REMOVED, Sources.BG,
- XXXValueWithUnit.Timestamp(glucoseValue.timestamp))
+ ValueWithUnit.Timestamp(glucoseValue.timestamp))
disposable += repository.runTransaction(InvalidateGlucoseValueTransaction(glucoseValue.id)).subscribe()
})
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusCarbsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusCarbsFragment.kt
index 5c2d62c396..c9621f55f9 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusCarbsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusCarbsFragment.kt
@@ -15,7 +15,7 @@ import info.nightscout.androidaps.database.entities.BolusCalculatorResult
import info.nightscout.androidaps.database.entities.Carbs
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.transactions.InvalidateBolusCalculatorResultTransaction
import info.nightscout.androidaps.database.transactions.InvalidateBolusTransaction
import info.nightscout.androidaps.database.transactions.InvalidateCarbsTransaction
@@ -336,8 +336,8 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
uel.log(
Action.TREATMENT_REMOVED, Sources.Treatments,
- XXXValueWithUnit.Timestamp(bolus.timestamp),
- XXXValueWithUnit.Insulin(bolus.amount)
+ ValueWithUnit.Timestamp(bolus.timestamp),
+ ValueWithUnit.Insulin(bolus.amount)
//XXXValueWithUnit.Gram(mealLinkLoaded.carbs.toInt())
)
disposable += repository.runTransactionForResult(InvalidateBolusTransaction(bolus.id))
@@ -358,8 +358,8 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
uel.log(
Action.TREATMENT_REMOVED, Sources.Treatments,
- XXXValueWithUnit.Timestamp(carb.timestamp),
- XXXValueWithUnit.Gram(carb.amount.toInt()))
+ ValueWithUnit.Timestamp(carb.timestamp),
+ ValueWithUnit.Gram(carb.amount.toInt()))
disposable += repository.runTransactionForResult(InvalidateCarbsTransaction(carb.id))
.subscribe(
{ result -> result.invalidated.forEach { aapsLogger.debug(LTag.DATABASE, "Invalidated carbs $it") } },
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt
index 83d57597b8..174f50c869 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt
@@ -10,7 +10,7 @@ import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
@@ -189,8 +189,8 @@ class TreatmentsCareportalFragment : DaggerFragment() {
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(therapyEvent.timestamp)
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
uel.log(Action.CAREPORTAL_REMOVED, Sources.Treatments, therapyEvent.note ,
- XXXValueWithUnit.Timestamp(therapyEvent.timestamp),
- XXXValueWithUnit.TherapyEventType(therapyEvent.type))
+ ValueWithUnit.Timestamp(therapyEvent.timestamp),
+ ValueWithUnit.TherapyEventType(therapyEvent.type))
disposable += repository.runTransactionForResult(InvalidateTherapyEventTransaction(therapyEvent.id))
.subscribe(
{ result -> result.invalidated.forEach { aapsLogger.debug(LTag.DATABASE, "Invalidated therapy event $it") } },
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt
index 7713e3ae73..6c8aede164 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt
@@ -9,7 +9,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.databinding.TreatmentsProfileswitchFragmentBinding
@@ -151,7 +151,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
resourceHelper.gs(R.string.careportal_profileswitch) + ": " + profileSwitch.profileName +
"\n" + resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
uel.log(Action.PROFILE_SWITCH_REMOVED, Sources.Treatments, profileSwitch.profileName,
- XXXValueWithUnit.Timestamp(profileSwitch.date))
+ ValueWithUnit.Timestamp(profileSwitch.date))
val id = profileSwitch._id
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
else uploadQueue.removeByMongoId("dbAdd", id)
@@ -166,8 +166,8 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
profileSwitch.profileObject?.let {
uel.log(Action.PROFILE_SWITCH_CLONED, Sources.Treatments,
profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_"),
- XXXValueWithUnit.Timestamp(profileSwitch.date),
- XXXValueWithUnit.SimpleString(profileSwitch.profileName))
+ ValueWithUnit.Timestamp(profileSwitch.date),
+ ValueWithUnit.SimpleString(profileSwitch.profileName))
val nonCustomized = it.convertToNonCustomizedProfile()
if (nonCustomized.isValid(resourceHelper.gs(R.string.careportal_profileswitch, false))) {
localProfilePlugin.addProfile(localProfilePlugin.copyFrom(nonCustomized, profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_")))
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.kt
index 1e4498be38..527bf5b0fd 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.kt
@@ -13,7 +13,7 @@ import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
@@ -197,11 +197,11 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
""".trimIndent(),
{ _: DialogInterface?, _: Int ->
uel.log(Action.TT_REMOVED, Sources.Treatments,
- XXXValueWithUnit.Timestamp(tempTarget.timestamp),
- XXXValueWithUnit.TherapyEventTTReason(tempTarget.reason),
- XXXValueWithUnit.Mgdl(tempTarget.lowTarget),
- XXXValueWithUnit.Mgdl(tempTarget.highTarget).takeIf { tempTarget.lowTarget != tempTarget.highTarget },
- XXXValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tempTarget.duration).toInt()))
+ ValueWithUnit.Timestamp(tempTarget.timestamp),
+ ValueWithUnit.TherapyEventTTReason(tempTarget.reason),
+ ValueWithUnit.Mgdl(tempTarget.lowTarget),
+ ValueWithUnit.Mgdl(tempTarget.highTarget).takeIf { tempTarget.lowTarget != tempTarget.highTarget },
+ ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tempTarget.duration).toInt()))
disposable += repository.runTransactionForResult(InvalidateTemporaryTargetTransaction(tempTarget.id))
.subscribe(
{ aapsLogger.debug(LTag.DATABASE, "Removed temp target $tempTarget") },
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt
index a0003c69e9..b951cc79d2 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt
@@ -12,7 +12,7 @@ import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.Intervals
import info.nightscout.androidaps.data.IobTotal
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.databinding.TreatmentsTempbasalsFragmentBinding
@@ -167,7 +167,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
""".trimIndent(),
{ _: DialogInterface?, _: Int ->
uel.log(Action.TT_REMOVED, Sources.Treatments,
- XXXValueWithUnit.Timestamp(tempBasal.date))
+ ValueWithUnit.Timestamp(tempBasal.date))
activePlugin.activeTreatments.removeTempBasal(tempBasal)
}, null)
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt
index 01177f85ef..4c64b1830a 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt
@@ -12,7 +12,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.entities.BolusCalculatorResult
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
@@ -350,8 +350,8 @@ class BolusWizard @Inject constructor(
notes = this@BolusWizard.notes
uel.log(Action.BOLUS_ADVISOR, if (quickWizard) Sources.QuickWizard else Sources.WizardDialog,
notes,
- XXXValueWithUnit.TherapyEventType(eventType.toDBbEventType()),
- XXXValueWithUnit.Insulin(insulinAfterConstraints))
+ ValueWithUnit.TherapyEventType(eventType.toDBbEventType()),
+ ValueWithUnit.Insulin(insulinAfterConstraints))
if (insulin > 0) {
commandQueue.bolus(this, object : Callback() {
override fun run() {
@@ -421,10 +421,10 @@ class BolusWizard @Inject constructor(
}
uel.log(action, if (quickWizard) Sources.QuickWizard else Sources.WizardDialog,
notes,
- XXXValueWithUnit.TherapyEventType(eventType.toDBbEventType()),
- XXXValueWithUnit.Insulin(insulinAfterConstraints).takeIf { insulinAfterConstraints != 0.0 },
- XXXValueWithUnit.Gram(this@BolusWizard.carbs).takeIf { this@BolusWizard.carbs != 0 },
- XXXValueWithUnit.Minute(carbTime).takeIf { carbTime != 0 })
+ ValueWithUnit.TherapyEventType(eventType.toDBbEventType()),
+ ValueWithUnit.Insulin(insulinAfterConstraints).takeIf { insulinAfterConstraints != 0.0 },
+ ValueWithUnit.Gram(this@BolusWizard.carbs).takeIf { this@BolusWizard.carbs != 0 },
+ ValueWithUnit.Minute(carbTime).takeIf { carbTime != 0 })
commandQueue.bolus(this, object : Callback() {
override fun run() {
if (!result.success) {
diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopSuspend.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopSuspend.kt
index c69e5d002c..49d0ba461e 100644
--- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopSuspend.kt
+++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopSuspend.kt
@@ -7,7 +7,7 @@ import info.nightscout.androidaps.automation.R
import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.database.entities.UserEntry
import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.events.EventRefreshOverview
import info.nightscout.androidaps.interfaces.LoopInterface
import info.nightscout.androidaps.logging.UserEntryLogger
@@ -38,7 +38,7 @@ class ActionLoopSuspend(injector: HasAndroidInjector) : Action(injector) {
loopPlugin.suspendLoop(minutes.getMinutes())
rxBus.send(EventRefreshOverview("ActionLoopSuspend"))
uel.log(UserEntry.Action.SUSPEND, Sources.Automation, title,
- XXXValueWithUnit.StringResource(R.string.suspendloopforXmin, listOf(XXXValueWithUnit.Minute(minutes.getMinutes()))))
+ ValueWithUnit.StringResource(R.string.suspendloopforXmin, listOf(ValueWithUnit.Minute(minutes.getMinutes()))))
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
} else {
callback.result(PumpEnactResult(injector).success(true).comment(R.string.alreadysuspended))?.run()
diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitch.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitch.kt
index 2017578531..c3623775ea 100644
--- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitch.kt
+++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitch.kt
@@ -7,7 +7,7 @@ import info.nightscout.androidaps.automation.R
import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.database.entities.UserEntry
import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.interfaces.ProfileFunction
@@ -59,8 +59,8 @@ class ActionProfileSwitch(injector: HasAndroidInjector) : Action(injector) {
return
}
uel.log(UserEntry.Action.PROFILE_SWITCH, Sources.Automation, title,
- XXXValueWithUnit.SimpleString(inputProfileName.value),
- XXXValueWithUnit.Percent(100))
+ ValueWithUnit.SimpleString(inputProfileName.value),
+ ValueWithUnit.Percent(100))
activePlugin.activeTreatments.doProfileSwitch(profileStore, inputProfileName.value, 0, 100, 0, DateUtil.now())
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
}
diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercent.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercent.kt
index d18739524a..3e024a4e00 100644
--- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercent.kt
+++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercent.kt
@@ -7,7 +7,7 @@ import info.nightscout.androidaps.automation.R
import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.database.entities.UserEntry
import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
@@ -43,7 +43,7 @@ class ActionProfileSwitchPercent(injector: HasAndroidInjector) : Action(injector
override fun doAction(callback: Callback) {
uel.log(UserEntry.Action.PROFILE_SWITCH, Sources.Automation, title,
- XXXValueWithUnit.StringResource( R.string.startprofile, listOf(XXXValueWithUnit.Percent(pct.value.toInt()), XXXValueWithUnit.Minute(duration.value))))
+ ValueWithUnit.StringResource( R.string.startprofile, listOf(ValueWithUnit.Percent(pct.value.toInt()), ValueWithUnit.Minute(duration.value))))
activePlugin.activeTreatments.doProfileSwitch(duration.value, pct.value.toInt(), 0)
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
}
diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.kt
index f73950e5e8..444b89957f 100644
--- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.kt
+++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.kt
@@ -11,7 +11,7 @@ import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.UserEntry
import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.ProfileFunction
@@ -62,10 +62,10 @@ class ActionStartTempTarget(injector: HasAndroidInjector) : Action(injector) {
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") }
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
uel.log(UserEntry.Action.TT, Sources.Automation, title,
- XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.AUTOMATION),
- XXXValueWithUnit.fromGlucoseUnit(tt().lowTarget, Constants.MGDL),
- XXXValueWithUnit.fromGlucoseUnit(tt().highTarget, Constants.MGDL).takeIf { tt().lowTarget != tt().highTarget },
- XXXValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt().duration).toInt()))
+ ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.AUTOMATION),
+ ValueWithUnit.fromGlucoseUnit(tt().lowTarget, Constants.MGDL),
+ ValueWithUnit.fromGlucoseUnit(tt().highTarget, Constants.MGDL).takeIf { tt().lowTarget != tt().highTarget },
+ ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt().duration).toInt()))
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
}, {
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
diff --git a/core/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt b/core/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt
index 39ea20214e..5c94251621 100644
--- a/core/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt
+++ b/core/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt
@@ -1,7 +1,7 @@
package info.nightscout.androidaps.logging
import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.database.transactions.UserEntryTransaction
@@ -21,11 +21,11 @@ class UserEntryLogger @Inject constructor(
private val compositeDisposable = CompositeDisposable()
- fun log(action: Action, source: Sources, note: String? ="", vararg listvalues: XXXValueWithUnit?) = log(action, source, note, listvalues.toList())
+ fun log(action: Action, source: Sources, note: String? ="", vararg listvalues: ValueWithUnit?) = log(action, source, note, listvalues.toList())
- fun log(action: Action, source: Sources, vararg listvalues: XXXValueWithUnit?) = log(action, source,"", listvalues.toList())
+ fun log(action: Action, source: Sources, vararg listvalues: ValueWithUnit?) = log(action, source,"", listvalues.toList())
- fun log(action: Action, source: Sources, note: String? ="", listvalues: List = listOf()) {
+ fun log(action: Action, source: Sources, note: String? ="", listvalues: List = listOf()) {
val filteredValues = listvalues.toList().filter { it != null}
compositeDisposable += repository.runTransaction(UserEntryTransaction(
action = action,
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/ClassicPrefsFormat.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/ClassicPrefsFormat.kt
index d11e0fdf44..d9254ad50a 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/ClassicPrefsFormat.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/ClassicPrefsFormat.kt
@@ -78,7 +78,7 @@ class ClassicPrefsFormat @Inject constructor(
fun saveCsv(file: File, userEntries: List) {
try {
- val contents = userEntryPresentationHelper.UserEntriesToCsv(userEntries)
+ val contents = userEntryPresentationHelper.userEntriesToCsv(userEntries)
storage.putFileContents(file, contents)
} catch (e: FileNotFoundException) {
throw PrefFileNotFoundError(file.absolutePath)
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt b/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt
index be2fd0eb25..6bec01b4b4 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt
@@ -5,7 +5,7 @@ import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject
import javax.inject.Singleton
@@ -92,16 +92,16 @@ class Translator @Inject internal constructor(
Action.UNKNOWN -> resourceHelper.gs(R.string.unknown)
}
- fun translate(units: XXXValueWithUnit?): String = when(units) {
- is XXXValueWithUnit.Gram -> resourceHelper.gs(R.string.shortgram)
- is XXXValueWithUnit.Hour -> resourceHelper.gs(R.string.shorthour)
- is XXXValueWithUnit.Insulin -> resourceHelper.gs(R.string.insulin_unit_shortname)
- is XXXValueWithUnit.Mgdl -> resourceHelper.gs(R.string.mgdl)
- is XXXValueWithUnit.Minute -> resourceHelper.gs(R.string.shortminute)
- is XXXValueWithUnit.Mmoll -> resourceHelper.gs(R.string.mmol)
- is XXXValueWithUnit.Percent -> resourceHelper.gs(R.string.shortpercent)
- is XXXValueWithUnit.UnitPerHour -> resourceHelper.gs(R.string.profile_ins_units_per_hour)
- else -> ""
+ fun translate(units: ValueWithUnit?): String = when(units) {
+ is ValueWithUnit.Gram -> resourceHelper.gs(R.string.shortgram)
+ is ValueWithUnit.Hour -> resourceHelper.gs(R.string.shorthour)
+ is ValueWithUnit.Insulin -> resourceHelper.gs(R.string.insulin_unit_shortname)
+ is ValueWithUnit.Mgdl -> resourceHelper.gs(R.string.mgdl)
+ is ValueWithUnit.Minute -> resourceHelper.gs(R.string.shortminute)
+ is ValueWithUnit.Mmoll -> resourceHelper.gs(R.string.mmol)
+ is ValueWithUnit.Percent -> resourceHelper.gs(R.string.shortpercent)
+ is ValueWithUnit.UnitPerHour -> resourceHelper.gs(R.string.profile_ins_units_per_hour)
+ else -> ""
}
fun translate(meterType: TherapyEvent.MeterType): String = when(meterType) {
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/UserEntryPresentationHelper.kt b/core/src/main/java/info/nightscout/androidaps/utils/UserEntryPresentationHelper.kt
index 9c08465858..5d6ae9416d 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/UserEntryPresentationHelper.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/UserEntryPresentationHelper.kt
@@ -6,9 +6,9 @@ import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.database.entities.UserEntry
import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.database.entities.UserEntry.ColorGroup
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.UserEntry.Sources
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject
@@ -23,97 +23,97 @@ class UserEntryPresentationHelper @Inject constructor(
fun colorId(colorGroup: ColorGroup): Int = when (colorGroup) {
ColorGroup.InsulinTreatment -> R.color.basal
- ColorGroup.CarbTreatment -> R.color.carbs
- ColorGroup.TT -> R.color.tempTargetConfirmation
- ColorGroup.Profile -> R.color.white
- ColorGroup.Loop -> R.color.loopClosed
- ColorGroup.Careportal -> R.color.high
- ColorGroup.Pump -> R.color.iob
- ColorGroup.Aaps -> R.color.defaulttext
+ ColorGroup.CarbTreatment -> R.color.carbs
+ ColorGroup.TT -> R.color.tempTargetConfirmation
+ ColorGroup.Profile -> R.color.white
+ ColorGroup.Loop -> R.color.loopClosed
+ ColorGroup.Careportal -> R.color.high
+ ColorGroup.Pump -> R.color.iob
+ ColorGroup.Aaps -> R.color.defaulttext
else -> R.color.defaulttext
}
fun iconId(source: Sources): Int = when (source) {
- Sources.TreatmentDialog -> R.drawable.icon_insulin_carbs
- Sources.InsulinDialog -> R.drawable.ic_bolus
- Sources.CarbDialog -> R.drawable.ic_cp_bolus_carbs
- Sources.WizardDialog -> R.drawable.ic_calculator
- Sources.QuickWizard -> R.drawable.ic_quick_wizard
+ Sources.TreatmentDialog -> R.drawable.icon_insulin_carbs
+ Sources.InsulinDialog -> R.drawable.ic_bolus
+ Sources.CarbDialog -> R.drawable.ic_cp_bolus_carbs
+ Sources.WizardDialog -> R.drawable.ic_calculator
+ Sources.QuickWizard -> R.drawable.ic_quick_wizard
Sources.ExtendedBolusDialog -> R.drawable.ic_actions_startextbolus
- Sources.TTDialog -> R.drawable.ic_temptarget_high
+ Sources.TTDialog -> R.drawable.ic_temptarget_high
Sources.ProfileSwitchDialog -> R.drawable.ic_actions_profileswitch
- Sources.LoopDialog -> R.drawable.ic_loop_closed
- Sources.TempBasalDialog -> R.drawable.ic_actions_starttempbasal
- Sources.CalibrationDialog -> R.drawable.ic_calibration
- Sources.FillDialog -> R.drawable.ic_cp_pump_canula
- Sources.BgCheck -> R.drawable.ic_cp_bgcheck
- Sources.SensorInsert -> R.drawable.ic_cp_cgm_insert
- Sources.BatteryChange -> R.drawable.ic_cp_pump_battery
- Sources.Note -> R.drawable.ic_cp_note
- Sources.Exercise -> R.drawable.ic_cp_exercise
- Sources.Question -> R.drawable.ic_cp_question
- Sources.Announcement -> R.drawable.ic_cp_announcement
- Sources.Actions -> R.drawable.ic_action
- Sources.Automation -> R.drawable.ic_automation
- Sources.BG -> R.drawable.ic_generic_cgm
- Sources.LocalProfile -> R.drawable.ic_local_profile
- Sources.Loop -> R.drawable.ic_loop_closed_white
- Sources.Maintenance -> R.drawable.ic_maintenance
- Sources.NSClient -> R.drawable.ic_nightscout_syncs
- Sources.NSProfile -> R.drawable.ic_nightscout_profile
- Sources.Objectives -> R.drawable.ic_graduation
- Sources.Pump -> R.drawable.ic_generic_icon
- Sources.SMS -> R.drawable.ic_sms
- Sources.Treatments -> R.drawable.ic_treatments
- Sources.Wear -> R.drawable.ic_watch
- Sources.Food -> R.drawable.ic_food
- Sources.Stats -> R.drawable.ic_cp_stats
- Sources.ConfigBuilder -> R.drawable.ic_generic_icon
- Sources.Overview -> R.drawable.ic_generic_icon
- Sources.Unknown -> R.drawable.ic_generic_icon
+ Sources.LoopDialog -> R.drawable.ic_loop_closed
+ Sources.TempBasalDialog -> R.drawable.ic_actions_starttempbasal
+ Sources.CalibrationDialog -> R.drawable.ic_calibration
+ Sources.FillDialog -> R.drawable.ic_cp_pump_canula
+ Sources.BgCheck -> R.drawable.ic_cp_bgcheck
+ Sources.SensorInsert -> R.drawable.ic_cp_cgm_insert
+ Sources.BatteryChange -> R.drawable.ic_cp_pump_battery
+ Sources.Note -> R.drawable.ic_cp_note
+ Sources.Exercise -> R.drawable.ic_cp_exercise
+ Sources.Question -> R.drawable.ic_cp_question
+ Sources.Announcement -> R.drawable.ic_cp_announcement
+ Sources.Actions -> R.drawable.ic_action
+ Sources.Automation -> R.drawable.ic_automation
+ Sources.BG -> R.drawable.ic_generic_cgm
+ Sources.LocalProfile -> R.drawable.ic_local_profile
+ Sources.Loop -> R.drawable.ic_loop_closed_white
+ Sources.Maintenance -> R.drawable.ic_maintenance
+ Sources.NSClient -> R.drawable.ic_nightscout_syncs
+ Sources.NSProfile -> R.drawable.ic_nightscout_profile
+ Sources.Objectives -> R.drawable.ic_graduation
+ Sources.Pump -> R.drawable.ic_generic_icon
+ Sources.SMS -> R.drawable.ic_sms
+ Sources.Treatments -> R.drawable.ic_treatments
+ Sources.Wear -> R.drawable.ic_watch
+ Sources.Food -> R.drawable.ic_food
+ Sources.Stats -> R.drawable.ic_cp_stats
+ Sources.ConfigBuilder -> R.drawable.ic_generic_icon
+ Sources.Overview -> R.drawable.ic_generic_icon
+ Sources.Unknown -> R.drawable.ic_generic_icon
}
fun actionToColoredString(action: Action): Spanned = when (action) {
- Action.TREATMENT -> HtmlHelper.fromHtml(coloredAction(Action.BOLUS) + " + " + coloredAction(Action.CARBS))
- else -> HtmlHelper.fromHtml(coloredAction(action))
+ Action.TREATMENT -> HtmlHelper.fromHtml(coloredAction(Action.BOLUS) + " + " + coloredAction(Action.CARBS))
+ else -> HtmlHelper.fromHtml(coloredAction(action))
}
private fun coloredAction(action: Action): String = "${translator.translate(action)}"
- fun listToPresentationString(list: List) =
+ fun listToPresentationString(list: List) =
list.joinToString(separator = " ", transform = this::toPresentationString)
- private fun toPresentationString(valueWithUnit: XXXValueWithUnit?): String = when (valueWithUnit) {
- is XXXValueWithUnit.Gram -> "${valueWithUnit.value}${translator.translate(valueWithUnit)}"
- is XXXValueWithUnit.Hour -> "${valueWithUnit.value}${translator.translate(valueWithUnit)}"
- is XXXValueWithUnit.Minute -> "${valueWithUnit.value}${translator.translate(valueWithUnit)}"
- is XXXValueWithUnit.Percent -> "${valueWithUnit.value}${translator.translate(valueWithUnit)}"
- is XXXValueWithUnit.Insulin -> DecimalFormatter.to2Decimal(valueWithUnit.value) + translator.translate(valueWithUnit)
- is XXXValueWithUnit.UnitPerHour -> DecimalFormatter.to2Decimal(valueWithUnit.value) + translator.translate(valueWithUnit)
- is XXXValueWithUnit.SimpleInt -> valueWithUnit.value.toString()
- is XXXValueWithUnit.SimpleString -> valueWithUnit.value
-// is XXXValueWithUnit.StringResource -> resourceHelper.gs(valueWithUnit.value, valueWithUnit.params.map{ it.value() }.toTypedArray()) //Todo Fix StringResource with Param
- is XXXValueWithUnit.StringResource -> if (valueWithUnit.params.size > 0 ) valueWithUnit.params.joinToString(separator = " ") { value -> toPresentationString(value) } else resourceHelper.gs(valueWithUnit.value) //To help debugging
- is XXXValueWithUnit.TherapyEventMeterType -> translator.translate(valueWithUnit.value)
- is XXXValueWithUnit.TherapyEventTTReason -> translator.translate(valueWithUnit.value)
- is XXXValueWithUnit.TherapyEventType -> translator.translate(valueWithUnit.value)
- is XXXValueWithUnit.Timestamp -> dateUtil.dateAndTimeAndSecondsString(valueWithUnit.value)
+ private fun toPresentationString(valueWithUnit: ValueWithUnit?): String = when (valueWithUnit) {
+ is ValueWithUnit.Gram -> "${valueWithUnit.value}${translator.translate(valueWithUnit)}"
+ is ValueWithUnit.Hour -> "${valueWithUnit.value}${translator.translate(valueWithUnit)}"
+ is ValueWithUnit.Minute -> "${valueWithUnit.value}${translator.translate(valueWithUnit)}"
+ is ValueWithUnit.Percent -> "${valueWithUnit.value}${translator.translate(valueWithUnit)}"
+ is ValueWithUnit.Insulin -> DecimalFormatter.to2Decimal(valueWithUnit.value) + translator.translate(valueWithUnit)
+ is ValueWithUnit.UnitPerHour -> DecimalFormatter.to2Decimal(valueWithUnit.value) + translator.translate(valueWithUnit)
+ is ValueWithUnit.SimpleInt -> valueWithUnit.value.toString()
+ is ValueWithUnit.SimpleString -> valueWithUnit.value
+ is ValueWithUnit.StringResource -> resourceHelper.gs(valueWithUnit.value, *(valueWithUnit.params.map { it.value() }.toTypedArray())) //Todo Fix StringResource with Param
+ // is XXXValueWithUnit.StringResource -> if (valueWithUnit.params.size > 0 ) valueWithUnit.params.joinToString(separator = " ") { value -> toPresentationString(value) } else resourceHelper.gs(valueWithUnit.value) //To help debugging
+ is ValueWithUnit.TherapyEventMeterType -> translator.translate(valueWithUnit.value)
+ is ValueWithUnit.TherapyEventTTReason -> translator.translate(valueWithUnit.value)
+ is ValueWithUnit.TherapyEventType -> translator.translate(valueWithUnit.value)
+ is ValueWithUnit.Timestamp -> dateUtil.dateAndTimeAndSecondsString(valueWithUnit.value)
- is XXXValueWithUnit.Mgdl -> {
+ is ValueWithUnit.Mgdl -> {
if (profileFunction.getUnits() == Constants.MGDL) DecimalFormatter.to0Decimal(valueWithUnit.value) + translator.translate(valueWithUnit)
else DecimalFormatter.to1Decimal(valueWithUnit.value / Constants.MMOLL_TO_MGDL) + translator.translate(valueWithUnit)
}
- is XXXValueWithUnit.Mmoll -> {
+ is ValueWithUnit.Mmoll -> {
if (profileFunction.getUnits() == Constants.MGDL) DecimalFormatter.to0Decimal(valueWithUnit.value) + translator.translate(valueWithUnit)
else DecimalFormatter.to1Decimal(valueWithUnit.value * Constants.MMOLL_TO_MGDL) + translator.translate(valueWithUnit)
}
- XXXValueWithUnit.UNKNOWN -> ""
- null -> ""
+ ValueWithUnit.UNKNOWN -> ""
+ null -> ""
}
- fun UserEntriesToCsv(userEntries: List): String {
+ fun userEntriesToCsv(userEntries: List): String {
return getCsvHeader() + userEntries.joinToString("\n") { entry -> getCsvEntry(entry) }
}
@@ -127,7 +127,7 @@ class UserEntryPresentationHelper @Inject constructor(
csvString(R.string.careportal_note),
csvString(R.string.ue_formated_string),
csvString(R.string.event_time_label),
- csvString(if (profileFunction.getUnits() == Constants.MGDL) R.string.mgdl else R.string.mmol ),
+ csvString(if (profileFunction.getUnits() == Constants.MGDL) R.string.mgdl else R.string.mmol),
csvString(R.string.shortgram),
csvString(R.string.insulin_unit_shortname),
csvString(R.string.profile_ins_units_per_hour),
@@ -138,7 +138,7 @@ class UserEntryPresentationHelper @Inject constructor(
) + "\n"
private fun getCsvEntry(entry: UserEntry): String {
- val fullvalueWithUnitList = ArrayList(entry.values)
+ val fullvalueWithUnitList = ArrayList(entry.values)
var timestampRec = "" + entry.timestamp
var dateTimestampRev = dateUtil.dateAndTimeAndSecondsString(entry.timestamp)
var utcOffset = dateUtil.timeString(entry.utcOffset)
@@ -157,46 +157,53 @@ class UserEntryPresentationHelper @Inject constructor(
var minute = ""
var other = ""
for (valueWithUnit in entry.values) {
- if (valueWithUnit is XXXValueWithUnit.StringResource) fullvalueWithUnitList.addAll(valueWithUnit.params)
+ if (valueWithUnit is ValueWithUnit.StringResource) fullvalueWithUnitList.addAll(valueWithUnit.params)
}
- for (valueWithUnit in fullvalueWithUnitList.filter { it != null }) {
+ for (valueWithUnit in fullvalueWithUnitList.filterNotNull()) {
when (valueWithUnit) {
- is XXXValueWithUnit.Gram -> gram = valueWithUnit.value.toString()
- is XXXValueWithUnit.Hour -> hour = valueWithUnit.value.toString()
- is XXXValueWithUnit.Minute -> minute = valueWithUnit.value.toString()
- is XXXValueWithUnit.Percent -> percent = valueWithUnit.value.toString()
- is XXXValueWithUnit.Insulin -> insulin = DecimalFormatter.to2Decimal(valueWithUnit.value)
- is XXXValueWithUnit.UnitPerHour -> unitPerHour = DecimalFormatter.to2Decimal(valueWithUnit.value)
- is XXXValueWithUnit.SimpleInt -> other = if (other == "") valueWithUnit.value.toString() else other + " / " + valueWithUnit.value.toString()
- is XXXValueWithUnit.SimpleString -> other = if (other == "") valueWithUnit.value else other + " / " + valueWithUnit.value
+ is ValueWithUnit.Gram -> gram = valueWithUnit.value.toString()
+ is ValueWithUnit.Hour -> hour = valueWithUnit.value.toString()
+ is ValueWithUnit.Minute -> minute = valueWithUnit.value.toString()
+ is ValueWithUnit.Percent -> percent = valueWithUnit.value.toString()
+ is ValueWithUnit.Insulin -> insulin = DecimalFormatter.to2Decimal(valueWithUnit.value)
+ is ValueWithUnit.UnitPerHour -> unitPerHour = DecimalFormatter.to2Decimal(valueWithUnit.value)
+ is ValueWithUnit.SimpleInt -> other = other.addWithSeparator(valueWithUnit.value)
+ is ValueWithUnit.SimpleString -> other = other.addWithSeparator(valueWithUnit.value)
// is XXXValueWithUnit.StringResource -> stringResource = if (stringResource == "") resourceHelper.gs(valueWithUnit.value, valueWithUnit.params.map { it.value() }.toTypedArray()) else stringResource + " / " + resourceHelper.gs(valueWithUnit.value, valueWithUnit.params.map { it.value() }.toTypedArray())
- is XXXValueWithUnit.StringResource -> if (valueWithUnit.params.size == 0) { stringResource = if (stringResource == "") resourceHelper.gs(valueWithUnit.value) else stringResource + " / " + resourceHelper.gs(valueWithUnit.value)}
- is XXXValueWithUnit.TherapyEventMeterType -> therapyEvent = if (therapyEvent == "") translator.translate(valueWithUnit.value) else therapyEvent + " / " + translator.translate(valueWithUnit.value)
- is XXXValueWithUnit.TherapyEventTTReason -> therapyEvent = if (therapyEvent == "") translator.translate(valueWithUnit.value) else therapyEvent + " / " + translator.translate(valueWithUnit.value)
- is XXXValueWithUnit.TherapyEventType -> therapyEvent = if (therapyEvent == "") translator.translate(valueWithUnit.value) else therapyEvent + " / " + translator.translate(valueWithUnit.value)
- is XXXValueWithUnit.Timestamp -> timestamp = dateUtil.dateAndTimeAndSecondsString(valueWithUnit.value)
-
- is XXXValueWithUnit.Mgdl -> {
- bg = if (profileFunction.getUnits() == Constants.MGDL) DecimalFormatter.to0Decimal(valueWithUnit.value)
- else DecimalFormatter.to1Decimal(valueWithUnit.value / Constants.MMOLL_TO_MGDL)
+ is ValueWithUnit.StringResource -> if (valueWithUnit.params.isEmpty()) {
+ stringResource = if (stringResource == "") resourceHelper.gs(valueWithUnit.value) else stringResource + " / " + resourceHelper.gs(valueWithUnit.value)
}
- is XXXValueWithUnit.Mmoll -> {
+ is ValueWithUnit.TherapyEventMeterType -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
+ is ValueWithUnit.TherapyEventTTReason -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
+ is ValueWithUnit.TherapyEventType -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
+ is ValueWithUnit.Timestamp -> timestamp = dateUtil.dateAndTimeAndSecondsString(valueWithUnit.value)
+
+ is ValueWithUnit.Mgdl -> {
bg = if (profileFunction.getUnits() == Constants.MGDL) DecimalFormatter.to0Decimal(valueWithUnit.value)
- else DecimalFormatter.to1Decimal(valueWithUnit.value * Constants.MMOLL_TO_MGDL)
+ else DecimalFormatter.to1Decimal(valueWithUnit.value / Constants.MMOLL_TO_MGDL)
}
+ is ValueWithUnit.Mmoll -> {
+ bg = if (profileFunction.getUnits() == Constants.MGDL) DecimalFormatter.to0Decimal(valueWithUnit.value)
+ else DecimalFormatter.to1Decimal(valueWithUnit.value * Constants.MMOLL_TO_MGDL)
+ }
+
+ ValueWithUnit.UNKNOWN -> Unit
}
}
therapyEvent = csvString(therapyEvent)
stringResource = csvString(stringResource)
other = csvString(other)
- return timestampRec + ";" + dateTimestampRev + ";" + utcOffset + ";" + action + ";" + therapyEvent + ";" + source + ";" + note + ";" + stringResource + ";" + timestamp + ";" + bg + ";" + gram + ";" + insulin + ";" + unitPerHour + ";" + percent + ";" + hour + ";" + minute + ";" + other
+ return "$timestampRec;$dateTimestampRev;$utcOffset;$action;$therapyEvent;$source;$note;$stringResource;$timestamp;$bg;$gram;$insulin;$unitPerHour;$percent;$hour;$minute;$other"
}
private fun saveString(id: Int): String = if (id != 0) resourceHelper.gs(id) else ""
private fun csvString(action: Action): String = "\"" + translator.translate(action).replace("\"", "\"\"") + "\""
private fun csvString(id: Int): String = if (id != 0) "\"" + resourceHelper.gs(id).replace("\"", "\"\"") + "\"" else ""
private fun csvString(s: String): String = if (s != "") "\"" + s.replace("\"", "\"\"") + "\"" else ""
+
+ private fun String.addWithSeparator(add: Any) =
+ this + (if (this.isBlank()) "" else " / ") + add.toString()
}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiser.kt b/core/src/main/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiser.kt
index c5a8c6948b..42db084ddc 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiser.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiser.kt
@@ -1,14 +1,14 @@
package info.nightscout.androidaps.utils.serialisation
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
object ValueWithUnitSerialiser {
- fun toSealedClassJson(list: List): String = list.map(::ValueWithUnitWrapper)
+ fun toSealedClassJson(list: List): String = list.map(::ValueWithUnitWrapper)
.let(SealedClassHelper.gson::toJson)
- fun fromJson(string: String): List = SealedClassHelper.gson
+ fun fromJson(string: String): List = SealedClassHelper.gson
.fromJson>(string).map { it.wrapped }
- private class ValueWithUnitWrapper(val wrapped: XXXValueWithUnit)
+ private class ValueWithUnitWrapper(val wrapped: ValueWithUnit)
}
\ No newline at end of file
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index 54a271834d..50412c35b8 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -481,7 +481,7 @@
Timestamp
No Unit
Export User Entries to Excel (csv)
- "%1$s;%2$s;%3$s;%4$s;%5$s;%6$s;%7$s;%8$s;%9$s;%10$s;%11$s;%12$s;%13$s;%14$s;%15$s;%16$s;%17$s"
+ "%1$s;%2$s;%3$s;%4$s;%5$s;%6$s;%7$s;%8$s;%9$s;%10$s;%11$s;%12$s;%13$s;%14$s;%15$s;%16$s;%17$s"
- %1$d day
diff --git a/core/src/test/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiserTest.kt b/core/src/test/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiserTest.kt
index ac3b874603..16123cf67b 100644
--- a/core/src/test/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiserTest.kt
+++ b/core/src/test/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiserTest.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.utils.serialisation
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
import org.junit.Assert
import org.junit.Test
@@ -9,10 +9,10 @@ internal class ValueWithUnitSerialiserTest {
@Test
fun testSerialisationDeserization() {
- val list = listOf(
- XXXValueWithUnit.SimpleString("hello"),
- XXXValueWithUnit.SimpleInt(5),
- XXXValueWithUnit.UNKNOWN
+ val list = listOf(
+ ValueWithUnit.SimpleString("hello"),
+ ValueWithUnit.SimpleInt(5),
+ ValueWithUnit.UNKNOWN
)
val serialized = ValueWithUnitSerialiser.toSealedClassJson(list)
@@ -25,7 +25,7 @@ internal class ValueWithUnitSerialiserTest {
@Test
fun testEmptyList() {
- val list = listOf()
+ val list = listOf()
val serialized = ValueWithUnitSerialiser.toSealedClassJson(list)
val deserialized = ValueWithUnitSerialiser.fromJson(serialized)
diff --git a/database/src/main/java/info/nightscout/androidaps/database/Converters.kt b/database/src/main/java/info/nightscout/androidaps/database/Converters.kt
index a011e892ef..7cd67f602f 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/Converters.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/Converters.kt
@@ -27,14 +27,14 @@ class Converters {
fun toSource(source: String?) = source?.let { Sources.fromString(it) }
@TypeConverter
- fun fromListOfXXXValueWithUnit(values: List): String = values.map(::ValueWithUnitWrapper)
+ fun fromListOfXXXValueWithUnit(values: List): String = values.map(::ValueWithUnitWrapper)
.let(SealedClassHelper.gson::toJson)
@TypeConverter
- fun toMutableListOfXXXValueWithUnit(string: String): List = SealedClassHelper.gson
+ fun toMutableListOfXXXValueWithUnit(string: String): List = SealedClassHelper.gson
.fromJson>(string).map { it.wrapped }
- private class ValueWithUnitWrapper(val wrapped: XXXValueWithUnit)
+ private class ValueWithUnitWrapper(val wrapped: ValueWithUnit)
@TypeConverter
fun fromBolusType(bolusType: Bolus.Type?) = bolusType?.name
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
index ed7e2a5d33..a60b5e6c7a 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
@@ -16,7 +16,7 @@ data class UserEntry(
var action: Action,
var source: Sources,
var note: String,
- var values: List
+ var values: List
) : DBEntry, DBEntryWithTime {
enum class Action (val colorGroup: ColorGroup) {
BOLUS (ColorGroup.InsulinTreatment),
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/XXXValueWithUnit.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/ValueWithUnit.kt
similarity index 67%
rename from database/src/main/java/info/nightscout/androidaps/database/entities/XXXValueWithUnit.kt
rename to database/src/main/java/info/nightscout/androidaps/database/entities/ValueWithUnit.kt
index 5ef5e26aac..7846438307 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/XXXValueWithUnit.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/ValueWithUnit.kt
@@ -2,39 +2,39 @@ package info.nightscout.androidaps.database.entities
import androidx.annotation.StringRes
-sealed class XXXValueWithUnit {
+sealed class ValueWithUnit {
- object UNKNOWN : XXXValueWithUnit() // formerly None used as fallback
+ object UNKNOWN : ValueWithUnit() // formerly None used as fallback
- data class SimpleString(val value: String) : XXXValueWithUnit() // formerly one usage of None
+ data class SimpleString(val value: String) : ValueWithUnit() // formerly one usage of None
- data class SimpleInt(val value: Int) : XXXValueWithUnit() // formerly one usage of None
+ data class SimpleInt(val value: Int) : ValueWithUnit() // formerly one usage of None
- data class Mgdl(val value: Double) : XXXValueWithUnit()
+ data class Mgdl(val value: Double) : ValueWithUnit()
- data class Mmoll(val value: Double) : XXXValueWithUnit()
+ data class Mmoll(val value: Double) : ValueWithUnit()
- data class Timestamp(val value: Long) : XXXValueWithUnit()
+ data class Timestamp(val value: Long) : ValueWithUnit()
- data class Insulin(val value: Double) : XXXValueWithUnit()
+ data class Insulin(val value: Double) : ValueWithUnit()
- data class UnitPerHour(val value: Double) : XXXValueWithUnit()
+ data class UnitPerHour(val value: Double) : ValueWithUnit()
- data class Gram(val value: Int) : XXXValueWithUnit()
+ data class Gram(val value: Int) : ValueWithUnit()
- data class Minute(val value: Int) : XXXValueWithUnit()
+ data class Minute(val value: Int) : ValueWithUnit()
- data class Hour(val value: Int) : XXXValueWithUnit()
+ data class Hour(val value: Int) : ValueWithUnit()
- data class Percent(val value: Int) : XXXValueWithUnit()
+ data class Percent(val value: Int) : ValueWithUnit()
- data class TherapyEventType(val value: TherapyEvent.Type) : XXXValueWithUnit()
+ data class TherapyEventType(val value: TherapyEvent.Type) : ValueWithUnit()
- data class TherapyEventMeterType(val value: TherapyEvent.MeterType) : XXXValueWithUnit()
+ data class TherapyEventMeterType(val value: TherapyEvent.MeterType) : ValueWithUnit()
- data class TherapyEventTTReason(val value: TemporaryTarget.Reason) : XXXValueWithUnit()
+ data class TherapyEventTTReason(val value: TemporaryTarget.Reason) : ValueWithUnit()
- data class StringResource(@StringRes val value: Int, val params: List = listOf()) : XXXValueWithUnit()
+ data class StringResource(@StringRes val value: Int, val params: List = listOf()) : ValueWithUnit()
fun value(): Any? {
return when(this) {
@@ -58,7 +58,7 @@ sealed class XXXValueWithUnit {
}
companion object {
- fun fromGlucoseUnit(value: Double, string: String): XXXValueWithUnit? = when (string) {
+ fun fromGlucoseUnit(value: Double, string: String): ValueWithUnit? = when (string) {
"mg/dl", "mgdl" -> Mgdl(value)
"mmol", "mmol/l" -> Mmoll(value)
else -> null
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/UserEntryTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/UserEntryTransaction.kt
index 736993b8a3..714661fc36 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/transactions/UserEntryTransaction.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/UserEntryTransaction.kt
@@ -3,13 +3,13 @@ package info.nightscout.androidaps.database.transactions
import info.nightscout.androidaps.database.entities.UserEntry
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.XXXValueWithUnit
+import info.nightscout.androidaps.database.entities.ValueWithUnit
class UserEntryTransaction(
val action: Action,
val source: Sources,
val note: String,
- val values: List = listOf()
+ val values: List = listOf()
) : Transaction() {
override fun run() {