Merge pull request #2919 from Philoul/AddCalibrationInTreatmentTab

Add Manual BG or Calibration in CarePortal Tab of Treatment
This commit is contained in:
Milos Kozak 2020-08-24 21:45:56 +02:00 committed by GitHub
commit cc8b22aa31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 28 deletions

View file

@ -156,9 +156,9 @@ class CareDialog : DialogFragmentWithDate() {
if (options == EventType.BGCHECK || options == EventType.QUESTION || options == EventType.ANNOUNCEMENT) { if (options == EventType.BGCHECK || options == EventType.QUESTION || options == EventType.ANNOUNCEMENT) {
val type = val type =
when { when {
actions_care_meter.isChecked -> "Finger" actions_care_meter.isChecked -> CareportalEvent.FINGER
actions_care_sensor.isChecked -> "Sensor" actions_care_sensor.isChecked -> CareportalEvent.SENSOR
else -> "Manual" else -> CareportalEvent.MANUAL
} }
actions.add(resourceHelper.gs(R.string.careportal_newnstreatment_glucosetype) + ": " + translator.translate(type)) actions.add(resourceHelper.gs(R.string.careportal_newnstreatment_glucosetype) + ": " + translator.translate(type))
actions.add(resourceHelper.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(profileFunction, actions_care_bg.value) + " " + resourceHelper.gs(unitResId)) actions.add(resourceHelper.gs(R.string.treatments_wizard_bg_label) + ": " + Profile.toCurrentUnitsString(profileFunction, actions_care_bg.value) + " " + resourceHelper.gs(unitResId))

View file

@ -78,6 +78,18 @@ public class CareportalEvent implements DataPointWithLabelInterface, Interval {
public static final String MBG = "Mbg"; // comming from entries public static final String MBG = "Mbg"; // comming from entries
// found in CareDialog.kt file
public static final String FINGER = "Finger";
public static final String SENSOR = "Sensor";
public static final String MANUAL = "Manual";
// found in Translator.kt
public static final String SNACKBOLUS = "Snack Bolus";
public static final String SENSORSTART = "Sensor Start";
public static final String TEMPBASALSTART = "Temp Basal Start";
public static final String TEMPBASALEND = "Temp Basal End";
public static final String TEMPBASALCANCEL = "Temporary Target Cancel";
@Deprecated @Deprecated
public CareportalEvent() { public CareportalEvent() {
StaticInjector.Companion.getInstance().androidInjector().inject(this); StaticInjector.Companion.getInstance().androidInjector().inject(this);

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.utils package info.nightscout.androidaps.utils
import info.nightscout.androidaps.core.R import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.db.CareportalEvent
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
@ -15,30 +16,31 @@ class Translator @Inject internal constructor(
fun translate(text: String): String = fun translate(text: String): String =
when (text) { when (text) {
"BG Check" -> resourceHelper.gs(R.string.careportal_bgcheck) CareportalEvent.BGCHECK -> resourceHelper.gs(R.string.careportal_bgcheck)
"Snack Bolus" -> resourceHelper.gs(R.string.careportal_snackbolus) CareportalEvent.SNACKBOLUS -> resourceHelper.gs(R.string.careportal_snackbolus)
"Meal Bolus" -> resourceHelper.gs(R.string.careportal_mealbolus) CareportalEvent.MEALBOLUS -> resourceHelper.gs(R.string.careportal_mealbolus)
"Correction Bolus" -> resourceHelper.gs(R.string.careportal_correctionbolus) CareportalEvent.CORRECTIONBOLUS -> resourceHelper.gs(R.string.careportal_correctionbolus)
"Carb Correction" -> resourceHelper.gs(R.string.careportal_carbscorrection) CareportalEvent.CARBCORRECTION -> resourceHelper.gs(R.string.careportal_carbscorrection)
"Combo Bolus" -> resourceHelper.gs(R.string.careportal_combobolus) CareportalEvent.COMBOBOLUS -> resourceHelper.gs(R.string.careportal_combobolus)
"Announcement" -> resourceHelper.gs(R.string.careportal_announcement) CareportalEvent.ANNOUNCEMENT -> resourceHelper.gs(R.string.careportal_announcement)
"Note" -> resourceHelper.gs(R.string.careportal_note) CareportalEvent.NOTE -> resourceHelper.gs(R.string.careportal_note)
"Question" -> resourceHelper.gs(R.string.careportal_question) CareportalEvent.QUESTION -> resourceHelper.gs(R.string.careportal_question)
"Exercise" -> resourceHelper.gs(R.string.careportal_exercise) CareportalEvent.EXERCISE -> resourceHelper.gs(R.string.careportal_exercise)
"Site Change" -> resourceHelper.gs(R.string.careportal_pumpsitechange) CareportalEvent.SITECHANGE -> resourceHelper.gs(R.string.careportal_pumpsitechange)
"Pump Battery Change" -> resourceHelper.gs(R.string.careportal_pumpbatterychange) CareportalEvent.PUMPBATTERYCHANGE -> resourceHelper.gs(R.string.careportal_pumpbatterychange)
"Sensor Start" -> resourceHelper.gs(R.string.careportal_cgmsensorstart) CareportalEvent.SENSORSTART -> resourceHelper.gs(R.string.careportal_cgmsensorstart)
"Sensor Change" -> resourceHelper.gs(R.string.careportal_cgmsensorinsert) CareportalEvent.SENSORCHANGE -> resourceHelper.gs(R.string.careportal_cgmsensorinsert)
"Insulin Change" -> resourceHelper.gs(R.string.careportal_insulincartridgechange) CareportalEvent.INSULINCHANGE -> resourceHelper.gs(R.string.careportal_insulincartridgechange)
"Temp Basal Start" -> resourceHelper.gs(R.string.careportal_tempbasalstart) CareportalEvent.TEMPBASALSTART -> resourceHelper.gs(R.string.careportal_tempbasalstart)
"Temp Basal End" -> resourceHelper.gs(R.string.careportal_tempbasalend) CareportalEvent.TEMPBASALEND -> resourceHelper.gs(R.string.careportal_tempbasalend)
"Profile Switch" -> resourceHelper.gs(R.string.careportal_profileswitch) CareportalEvent.PROFILESWITCH -> resourceHelper.gs(R.string.careportal_profileswitch)
"Temporary Target" -> resourceHelper.gs(R.string.careportal_temporarytarget) CareportalEvent.TEMPORARYTARGET -> resourceHelper.gs(R.string.careportal_temporarytarget)
"Temporary Target Cancel" -> resourceHelper.gs(R.string.careportal_temporarytargetcancel) CareportalEvent.TEMPBASALCANCEL -> resourceHelper.gs(R.string.careportal_temporarytargetcancel)
"OpenAPS Offline" -> resourceHelper.gs(R.string.careportal_openapsoffline) CareportalEvent.OPENAPSOFFLINE -> resourceHelper.gs(R.string.careportal_openapsoffline)
"Finger" -> resourceHelper.gs(R.string.glucosetype_finger) CareportalEvent.MBG -> resourceHelper.gs(R.string.careportal_mbg)
"Sensor" -> resourceHelper.gs(R.string.glucosetype_sensor) CareportalEvent.FINGER -> resourceHelper.gs(R.string.glucosetype_finger)
"Manual" -> resourceHelper.gs(R.string.manual) CareportalEvent.SENSOR -> resourceHelper.gs(R.string.glucosetype_sensor)
else -> resourceHelper.gs(R.string.unknown) CareportalEvent.MANUAL -> resourceHelper.gs(R.string.manual)
else -> resourceHelper.gs(R.string.unknown)
} }
} }

View file

@ -167,6 +167,7 @@
<!-- Translator--> <!-- Translator-->
<string name="careportal_bgcheck">BG Check</string> <string name="careportal_bgcheck">BG Check</string>
<string name="careportal_mbg">Manual BG or Calibration</string>
<string name="careportal_announcement">Announcement</string> <string name="careportal_announcement">Announcement</string>
<string name="careportal_note">Note</string> <string name="careportal_note">Note</string>
<string name="careportal_question">Question</string> <string name="careportal_question">Question</string>