UserEntry refactor to include XXXValueWithUnit (Loop Dialog and ProfileSwitchDialog only)
This commit is contained in:
parent
a07b685e8d
commit
83f4d25527
5 changed files with 2967 additions and 32 deletions
|
@ -243,28 +243,28 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
val profile = profileFunction.getProfile() ?: return true
|
||||
when (v.id) {
|
||||
R.id.overview_closeloop -> {
|
||||
uel.log(Action.CLOSED_LOOP_MODE, ValueWithUnit(Sources.LoopDialog))
|
||||
uel.log(Action.CLOSED_LOOP_MODE, Sources.LoopDialog)
|
||||
sp.putString(R.string.key_aps_mode, "closed")
|
||||
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.closedloop)))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_lgsloop -> {
|
||||
uel.log(Action.LGS_LOOP_MODE, ValueWithUnit(Sources.LoopDialog))
|
||||
uel.log(Action.LGS_LOOP_MODE, Sources.LoopDialog)
|
||||
sp.putString(R.string.key_aps_mode, "lgs")
|
||||
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.lowglucosesuspend)))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_openloop -> {
|
||||
uel.log(Action.OPEN_LOOP_MODE, ValueWithUnit(Sources.LoopDialog))
|
||||
uel.log(Action.OPEN_LOOP_MODE, Sources.LoopDialog)
|
||||
sp.putString(R.string.key_aps_mode, "open")
|
||||
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.lowglucosesuspend)))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disable -> {
|
||||
uel.log(Action.LOOP_DISABLED, ValueWithUnit(Sources.LoopDialog))
|
||||
uel.log(Action.LOOP_DISABLED, Sources.LoopDialog)
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
|
||||
loopPlugin.setFragmentVisible(PluginType.LOOP, false)
|
||||
configBuilderPlugin.storeSettings("DisablingLoop")
|
||||
|
@ -281,7 +281,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_enable -> {
|
||||
uel.log(Action.LOOP_ENABLED, ValueWithUnit(Sources.LoopDialog))
|
||||
uel.log(Action.LOOP_ENABLED, Sources.LoopDialog)
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
|
||||
loopPlugin.setFragmentVisible(PluginType.LOOP, true)
|
||||
configBuilderPlugin.storeSettings("EnablingLoop")
|
||||
|
@ -291,8 +291,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_resume, R.id.overview_reconnect -> {
|
||||
//uel.log(if (v.id == R.id.overview_resume) Action.RESUME else Action.RECONNECT )
|
||||
uel.log(if (v.id==R.id.overview_resume) Action.RESUME else Action.RECONNECT, ValueWithUnit(Sources.LoopDialog))
|
||||
uel.log(if (v.id==R.id.overview_resume) Action.RESUME else Action.RECONNECT, Sources.LoopDialog)
|
||||
loopPlugin.suspendTo(0L)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
|
@ -308,56 +307,49 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_suspend_1h -> {
|
||||
//uel.log(Action.SUSPEND, XXXValueWithUnit.Hour(1))
|
||||
uel.log(Action.SUSPEND, ValueWithUnit(Sources.LoopDialog), ValueWithUnit(1, Units.H))
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, XXXValueWithUnit.Hour(1))
|
||||
loopPlugin.suspendLoop(60)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_2h -> {
|
||||
//uel.log(Action.SUSPEND, XXXValueWithUnit.Hour(2))
|
||||
uel.log(Action.SUSPEND, ValueWithUnit(Sources.LoopDialog), ValueWithUnit(2, Units.H))
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, XXXValueWithUnit.Hour(2))
|
||||
loopPlugin.suspendLoop(120)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_3h -> {
|
||||
//uel.log(Action.SUSPEND, XXXValueWithUnit.Hour(3))
|
||||
uel.log(Action.SUSPEND, ValueWithUnit(Sources.LoopDialog), ValueWithUnit(3, Units.H))
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, XXXValueWithUnit.Hour(3))
|
||||
loopPlugin.suspendLoop(180)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_10h -> {
|
||||
//uel.log(Action.SUSPEND, XXXValueWithUnit.Hour(10))
|
||||
uel.log(Action.SUSPEND, ValueWithUnit(Sources.LoopDialog), ValueWithUnit(10, Units.H))
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, XXXValueWithUnit.Hour(10))
|
||||
loopPlugin.suspendLoop(600)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_15m -> {
|
||||
//Muel.log(Action.DISCONNECT, XXXValueWithUnit.Minute(15))
|
||||
uel.log(Action.DISCONNECT, ValueWithUnit(Sources.LoopDialog), ValueWithUnit(15, Units.M))
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, XXXValueWithUnit.Minute(15))
|
||||
loopPlugin.disconnectPump(15, profile)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_30m -> {
|
||||
//uel.log(Action.DISCONNECT, XXXValueWithUnit.Minute(30))
|
||||
uel.log(Action.DISCONNECT, ValueWithUnit(Sources.LoopDialog), ValueWithUnit(30, Units.M))
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, XXXValueWithUnit.Minute(30))
|
||||
loopPlugin.disconnectPump(30, profile)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_1h -> {
|
||||
//uel.log(Action.DISCONNECT, XXXValueWithUnit.Hour(1))
|
||||
uel.log(Action.DISCONNECT, ValueWithUnit(Sources.LoopDialog), ValueWithUnit(1, Units.H))
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, XXXValueWithUnit.Hour(1))
|
||||
loopPlugin.disconnectPump(60, profile)
|
||||
sp.putBoolean(R.string.key_objectiveusedisconnect, true)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
|
@ -365,16 +357,14 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_disconnect_2h -> {
|
||||
//uel.log(Action.DISCONNECT, XXXValueWithUnit.Hour(2))
|
||||
uel.log(Action.DISCONNECT, ValueWithUnit(Sources.LoopDialog), ValueWithUnit(2, Units.H))
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, XXXValueWithUnit.Hour(2))
|
||||
loopPlugin.disconnectPump(120, profile)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disconnect_3h -> {
|
||||
//uel.log(Action.DISCONNECT, XXXValueWithUnit.Hour(3))
|
||||
uel.log(Action.DISCONNECT, ValueWithUnit(Sources.LoopDialog), ValueWithUnit(3, Units.H))
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, XXXValueWithUnit.Hour(3))
|
||||
loopPlugin.disconnectPump(180, profile)
|
||||
rxBus.send(EventRefreshOverview("suspendmenu"))
|
||||
return true
|
||||
|
|
|
@ -115,7 +115,7 @@ class ClassicPrefsFormat @Inject constructor(
|
|||
var action = csvString(entry.action)
|
||||
var therapyEvent = ""
|
||||
var source = ""
|
||||
var note = csvString(entry.s)
|
||||
var note = csvString(entry.note)
|
||||
var formatedString = ""
|
||||
var timestamp = ""
|
||||
var bg = ""
|
||||
|
@ -126,7 +126,7 @@ class ClassicPrefsFormat @Inject constructor(
|
|||
var h = ""
|
||||
var m = ""
|
||||
var other = ""
|
||||
|
||||
/*
|
||||
for (v in entry.values) {
|
||||
when (v.unit) {
|
||||
Units.Timestamp -> timestamp = dateUtil.dateAndTimeAndSecondsString(v.lValue)
|
||||
|
@ -154,6 +154,7 @@ class ClassicPrefsFormat @Inject constructor(
|
|||
else -> other = if (other == "") v.value().toString() else other + " / " + v.value().toString()
|
||||
}
|
||||
}
|
||||
*/
|
||||
therapyEvent = csvString(therapyEvent)
|
||||
formatedString = csvString(formatedString)
|
||||
other = csvString(other)
|
||||
|
|
|
@ -84,7 +84,7 @@ class UserEntryPresentationHelper @Inject constructor(
|
|||
private fun toPresentationString(valueWithUnit: XXXValueWithUnit?): String = when (valueWithUnit) {
|
||||
is XXXValueWithUnit.Gram -> "${valueWithUnit.value}${translator.translate(Units.G)}"
|
||||
is XXXValueWithUnit.Hour -> "${valueWithUnit.value}${translator.translate(Units.H)}"
|
||||
is XXXValueWithUnit.Minute -> "${valueWithUnit.value} ${translator.translate(Units.G)}"
|
||||
is XXXValueWithUnit.Minute -> "${valueWithUnit.value}${translator.translate(Units.M)}"
|
||||
is XXXValueWithUnit.Percent -> "${valueWithUnit.value}${translator.translate(Units.Percent)}"
|
||||
is XXXValueWithUnit.Insulin -> DecimalFormatter.to2Decimal(valueWithUnit.value) + translator.translate(UserEntry.Units.U)
|
||||
is XXXValueWithUnit.UnitPerHour -> DecimalFormatter.to2Decimal(valueWithUnit.value) + translator.translate(UserEntry.Units.U_H)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -62,4 +62,11 @@ open class DatabaseModule {
|
|||
database.execSQL("CREATE INDEX IF NOT EXISTS `index_mealLinks_noteId` ON mealLinks (`noteId`)")
|
||||
}
|
||||
}
|
||||
|
||||
private val migration10to11 = object : Migration(10,11) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
database.execSQL("DROP TABLE IF EXISTS userEntry")
|
||||
database.execSQL("CREATE TABLE IF NOT EXISTS userEntry (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `action` TEXT NOT NULL, `source` TEXT NOT NULL, `note` TEXT NOT NULL, `values` TEXT NOT NULL)")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue