From b1320c4bcb12b02b17815465c183da0734e5321d Mon Sep 17 00:00:00 2001 From: Andy Rozman Date: Tue, 23 Jul 2019 16:09:56 +0100 Subject: [PATCH] - added keys for preferences and fixes on all other places --- .../common/hw/rileylink/RileyLinkConst.java | 8 +++-- .../medtronic/driver/MedtronicPumpStatus.java | 2 +- .../pump/medtronic/util/MedtronicConst.java | 29 +++++++++++++------ app/src/main/res/values/strings.xml | 11 ++++++- app/src/main/res/xml/pref_medtronic.xml | 18 ++++++------ 5 files changed, 45 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkConst.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkConst.java index 51e5adc654..1f6f9c7541 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkConst.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkConst.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink; +import info.nightscout.androidaps.R; + /** * Created by andy on 16/05/2018. */ @@ -27,9 +29,9 @@ public class RileyLinkConst { public class Prefs { - public static final String PrefPrefix = "pref_rileylink_"; - public static final String RileyLinkAddress = PrefPrefix + "mac_address"; // pref_rileylink_mac_address - + //public static final String PrefPrefix = "pref_rileylink_"; + //public static final String RileyLinkAddress = PrefPrefix + "mac_address"; // pref_rileylink_mac_address + public static final int RileyLinkAddress = R.string.pref_key_rileylink_mac_address; public static final String LastGoodDeviceCommunicationTime = Prefix + "lastGoodDeviceCommunicationTime"; public static final String LastGoodDeviceFrequency = Prefix + "LastGoodDeviceFrequency"; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java index 00e54770dd..c6ad3fa4e4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java @@ -323,7 +323,7 @@ public class MedtronicPumpStatus extends PumpStatus { } - private double checkParameterValue(String key, String defaultValue, double defaultValueDouble) { + private double checkParameterValue(int key, String defaultValue, double defaultValueDouble) { double val = 0.0d; String value = SP.getString(key, defaultValue); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicConst.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicConst.java index 1be9e2f478..d867ec2d31 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicConst.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicConst.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.medtronic.util; +import info.nightscout.androidaps.R; + /** * Created by andy on 5/12/18. */ @@ -10,15 +12,24 @@ public class MedtronicConst { public class Prefs { - public static final String PrefPrefix = "pref_medtronic_"; - public static final String PumpSerial = PrefPrefix + "serial"; - public static final String PumpType = PrefPrefix + "pump_type"; - public static final String PumpFrequency = PrefPrefix + "frequency"; - public static final String MaxBolus = PrefPrefix + "max_bolus"; - public static final String MaxBasal = PrefPrefix + "max_basal"; - public static final String BolusDelay = PrefPrefix + "bolus_delay"; - public static final String Encoding = PrefPrefix + "encoding"; - public static final String BatteryType = PrefPrefix + "battery_type"; +// public static final String PrefPrefix = "pref_medtronic_"; +// public static final String PumpSerial = PrefPrefix + "serial"; +// public static final String PumpType = PrefPrefix + "pump_type"; +// public static final String PumpFrequency = PrefPrefix + "frequency"; +// public static final String MaxBolus = PrefPrefix + "max_bolus"; +// public static final String MaxBasal = PrefPrefix + "max_basal"; +// public static final String BolusDelay = PrefPrefix + "bolus_delay"; +// public static final String Encoding = PrefPrefix + "encoding"; +// public static final String BatteryType = PrefPrefix + "battery_type"; + + public static final int PumpSerial = R.string.pref_key_medtronic_serial; + public static final int PumpType = R.string.pref_key_medtronic_pump_type; + public static final int PumpFrequency = R.string.pref_key_medtronic_frequency; + public static final int MaxBolus = R.string.pref_key_medtronic_max_bolus; + public static final int MaxBasal = R.string.pref_key_medtronic_max_basal; + public static final int BolusDelay = R.string.pref_key_medtronic_bolus_delay; + public static final int Encoding = R.string.pref_key_medtronic_encoding; + public static final int BatteryType = R.string.pref_key_medtronic_battery_type; } public class Statistics { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3c9e5ed190..84f052434d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1391,6 +1391,16 @@ Pump integration for Medtronic, requires RileyLink device and specific Pump Model + pref_medtronic_serial + pref_medtronic_pump_type + pref_medtronic_frequency + pref_medtronic_max_bolus + pref_medtronic_max_basal + pref_medtronic_bolus_delay + pref_medtronic_encoding + pref_medtronic_battery_type + pref_rileylink_mac_address + Pump Serial Number Pump Type Pump Frequency @@ -1494,7 +1504,6 @@ Wrong Max Basal set on Pump (must be %1$.2f). Operation is not possible.\n\n You need to configure Medtronic Pump first, before you can use this operation. Over 24h Time change was requested. - xxx Basals diff --git a/app/src/main/res/xml/pref_medtronic.xml b/app/src/main/res/xml/pref_medtronic.xml index 3791fa574e..7be3b2b92d 100644 --- a/app/src/main/res/xml/pref_medtronic.xml +++ b/app/src/main/res/xml/pref_medtronic.xml @@ -5,7 +5,7 @@ @@ -14,7 +14,7 @@ android:defaultValue="1" android:entries="@array/medtronicPumpTypeArray" android:entryValues="@array/medtronicPumpTypeArray" - android:key="pref_medtronic_pump_type" + android:key="@string/pref_key_medtronic_pump_type" android:title="@string/medtronic_pump_type" /> @@ -22,13 +22,13 @@ android:defaultValue="1" android:entries="@array/medtronicPumpFreqArray" android:entryValues="@array/medtronicPumpFreqArray" - android:key="pref_medtronic_frequency" + android:key="@string/pref_key_medtronic_frequency" android:selectable="true" android:title="@string/medtronic_pump_frequency" /> @@ -56,7 +56,7 @@ android:defaultValue="@string/medtronic_pump_encoding_4b6b_rileylink" android:entries="@array/medtronicEncoding" android:entryValues="@array/medtronicEncoding" - android:key="pref_medtronic_encoding" + android:key="@string/pref_key_medtronic_encoding" android:selectable="true" android:title="@string/medtronic_pump_encoding" /> @@ -64,7 +64,7 @@ android:defaultValue="@string/medtronic_pump_battery_no" android:entries="@array/medtronicBatteryType" android:entryValues="@array/medtronicBatteryType" - android:key="pref_medtronic_battery_type" + android:key="@string/pref_key_medtronic_battery_type" android:selectable="true" android:title="@string/medtronic_pump_battery_select" /> @@ -73,7 +73,7 @@ android:enabled="true" android:summary="" android:title="RileyLink Configuration" - android:key="pref_rileylink_mac_address"> + android:key="@string/pref_key_rileylink_mac_address">