From b0f8ab99221e35ef147a3b7942eb68131be49446 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 23 Aug 2018 18:46:06 +0200 Subject: [PATCH] extract key_virtualpump_type --- .../plugins/PumpVirtual/VirtualPumpPlugin.java | 2 +- app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/pref_virtualpump.xml | 2 +- .../plugins/PumpVirtual/VirtualPumpPluginUTest.java | 10 ++++------ 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java index d7be4ef405..39f26fea05 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java @@ -427,7 +427,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface { public void refreshConfiguration() { - String pumptype = SP.getString("virtualpump_type", "Generic AAPS"); + String pumptype = SP.getString(R.string.key_virtualpump_type, "Generic AAPS"); PumpType pumpTypeNew = PumpType.getByDescription(pumptype); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 645b5cbf8a..ea378a6f0c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1083,6 +1083,7 @@ Max daily safety multiplier Current basal safety multiplier n/a + virtualpump_type Virtual Pump Type Pump Definition Bolus: Step=%1$s\nExtended Bolus: [Step=%2$s, Duration=%3$smin-%4$sh]\nBasal: Step=%5$s\nTBR: %6$s (by %7$s), Duration=%8$smin-%9$sh\n%10$s diff --git a/app/src/main/res/xml/pref_virtualpump.xml b/app/src/main/res/xml/pref_virtualpump.xml index ac65f5e228..367fa59531 100644 --- a/app/src/main/res/xml/pref_virtualpump.xml +++ b/app/src/main/res/xml/pref_virtualpump.xml @@ -13,7 +13,7 @@ android:defaultValue="1" android:entries="@array/virtualPumpTypes" android:entryValues="@array/virtualPumpTypes" - android:key="virtualpump_type" + android:key="@string/key_virtualpump_type" android:title="@string/virtualpump_type" /> diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPluginUTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPluginUTest.java index 4e2da58e06..4fcd65c90f 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPluginUTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPluginUTest.java @@ -6,19 +6,17 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Mock; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import info.AAPSMocker; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.PumpCommon.defs.PumpType; -import info.nightscout.androidaps.plugins.PumpInsight.InsightPlugin; import info.nightscout.utils.SP; import info.nightscout.utils.ToastUtils; -import static org.junit.Assert.*; import static org.powermock.api.mockito.PowerMockito.when; /** @@ -53,7 +51,7 @@ public class VirtualPumpPluginUTest { @Test public void refreshConfiguration() throws Exception { - when(SP.getString("virtualpump_type", "Generic AAPS")).thenReturn("Accu-Chek Combo"); + when(SP.getString(R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo"); virtualPumpPlugin.refreshConfiguration(); @@ -64,11 +62,11 @@ public class VirtualPumpPluginUTest { @Test public void refreshConfigurationTwice() throws Exception { - when(SP.getString("virtualpump_type", "Generic AAPS")).thenReturn("Accu-Chek Combo"); + when(SP.getString(R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo"); virtualPumpPlugin.refreshConfiguration(); - when(SP.getString("virtualpump_type", "Generic AAPS")).thenReturn("Accu-Chek Combo"); + when(SP.getString(R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo"); virtualPumpPlugin.refreshConfiguration();