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) {
val type =
when {
actions_care_meter.isChecked -> "Finger"
actions_care_sensor.isChecked -> "Sensor"
else -> "Manual"
actions_care_meter.isChecked -> CareportalEvent.FINGER
actions_care_sensor.isChecked -> CareportalEvent.SENSOR
else -> CareportalEvent.MANUAL
}
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))

View file

@ -78,6 +78,18 @@ public class CareportalEvent implements DataPointWithLabelInterface, Interval {
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
public CareportalEvent() {
StaticInjector.Companion.getInstance().androidInjector().inject(this);

View file

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

View file

@ -167,6 +167,7 @@
<!-- Translator-->
<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_note">Note</string>
<string name="careportal_question">Question</string>