Add Careportal and actions sources + icons

This commit is contained in:
Philoul 2021-03-25 23:08:32 +01:00
parent 0e835cfb23
commit 854715955a
14 changed files with 34 additions and 6 deletions

View file

@ -220,6 +220,17 @@ class CareDialog : DialogFragmentWithDate() {
therapyEvent.enteredBy = enteredBy
var source = when (options) {
EventType.BGCHECK -> Sources.BgCheck
EventType.SENSOR_INSERT -> Sources.SensorInsert
EventType.BATTERY_CHANGE -> Sources.BatteryChange
EventType.NOTE -> Sources.Note
EventType.EXERCISE -> Sources.Exercise
EventType.QUESTION -> Sources.Question
EventType.ANNOUNCEMENT -> Sources.Announcement
}
valuesWithUnit.add(ValueWithUnit(source))
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(event), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
disposable += repository.runTransactionForResult(InsertTherapyEventIfNewTransaction(therapyEvent)).subscribe({ result ->

View file

@ -136,11 +136,11 @@ class FillDialog : DialogFragmentWithDate() {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.primefill), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
if (insulinAfterConstraints > 0) {
uel.log(Action.PRIME_BOLUS, notes, ValueWithUnit(insulinAfterConstraints, Units.U, insulinAfterConstraints != 0.0))
uel.log(Action.PRIME_BOLUS, notes, ValueWithUnit(Sources.FillDialog), ValueWithUnit(insulinAfterConstraints, Units.U, insulinAfterConstraints != 0.0))
requestPrimeBolus(insulinAfterConstraints, notes)
}
if (siteChange) {
uel.log(Action.CAREPORTAL, notes, ValueWithUnit(eventTime, Units.Timestamp, eventTimeChanged), ValueWithUnit(TherapyEvent.Type.CANNULA_CHANGE.text, Units.TherapyEvent))
uel.log(Action.CAREPORTAL, notes, ValueWithUnit(Sources.FillDialog), ValueWithUnit(eventTime, Units.Timestamp, eventTimeChanged), ValueWithUnit(TherapyEvent.Type.CANNULA_CHANGE.text, Units.TherapyEvent))
disposable += repository.runTransactionForResult(InsertTherapyEventIfNewTransaction(
timestamp = eventTime,
type = TherapyEvent.Type.CANNULA_CHANGE,
@ -154,7 +154,7 @@ class FillDialog : DialogFragmentWithDate() {
}
if (insulinChange) {
// add a second for case of both checked
uel.log(Action.CAREPORTAL, notes, ValueWithUnit(eventTime, Units.Timestamp, eventTimeChanged), ValueWithUnit(TherapyEvent.Type.INSULIN_CHANGE.text, Units.TherapyEvent))
uel.log(Action.CAREPORTAL, notes, ValueWithUnit(Sources.FillDialog), ValueWithUnit(eventTime, Units.Timestamp, eventTimeChanged), ValueWithUnit(TherapyEvent.Type.INSULIN_CHANGE.text, Units.TherapyEvent))
disposable += repository.runTransactionForResult(InsertTherapyEventIfNewTransaction(
timestamp = eventTime + 1000,
type = TherapyEvent.Type.INSULIN_CHANGE,

View file

@ -155,7 +155,7 @@ class ActionsFragment : DaggerFragment() {
}
extendedBolusCancel?.setOnClickListener {
if (activePlugin.activeTreatments.isInHistoryExtendedBolusInProgress) {
uel.log(Action.CANCEL_EXTENDED_BOLUS)
uel.log(Action.CANCEL_EXTENDED_BOLUS, ValueWithUnit(Sources.Actions))
commandQueue.cancelExtended(object : Callback() {
override fun run() {
if (!result.success) {
@ -170,7 +170,7 @@ class ActionsFragment : DaggerFragment() {
}
cancelTempBasal?.setOnClickListener {
if (activePlugin.activeTreatments.isTempBasalInProgress) {
uel.log(Action.CANCEL_TEMP_BASAL)
uel.log(Action.CANCEL_TEMP_BASAL, ValueWithUnit(Sources.Actions))
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {

View file

@ -66,7 +66,6 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
}
}
}
}
fun swapAdapter() {

View file

@ -30,6 +30,15 @@ fun Sources.iconId(): Int {
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.Loop -> R.drawable.ic_loop_closed_white
Sources.NSClient -> R.drawable.ic_nightscout_syncs

View file

@ -145,6 +145,15 @@ data class UserEntry(
@SerializedName("LoopDialog") LoopDialog ("LoopDialog"),
@SerializedName("TempBasalDialog") TempBasalDialog ("TempBasalDialog"),
@SerializedName("CalibrationDialog") CalibrationDialog ("CalibrationDialog"),
@SerializedName("FillDialog") FillDialog ("FillDialog"),
@SerializedName("BgCheck") BgCheck ("BgCheck"),
@SerializedName("SensorInsert") SensorInsert ("SensorInsert"),
@SerializedName("BatteryChange") BatteryChange ("BatteryChange"),
@SerializedName("Note") Note ("Note"),
@SerializedName("Exercise") Exercise ("Exercise"),
@SerializedName("Question") Question ("Question"),
@SerializedName("Announcement") Announcement ("Announcement"),
@SerializedName("Actions") Actions ("Actions"), //From Actions plugin
@SerializedName("Automation") Automation ("Automation"), //From Automation plugin
@SerializedName("Loop") Loop ("Loop"), //From Loop plugin
@SerializedName("NSClient") NSClient ("NSClient"), //From NSClient plugin