diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt index 8d54db21f6..2541f50bc7 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -24,8 +24,6 @@ import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.diaconn.DiaconnG8Plugin import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin -import info.nightscout.plugins.general.wear.WearPlugin -import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin import info.nightscout.androidaps.plugins.pump.combov2.ComboV2Plugin import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin @@ -45,6 +43,7 @@ import info.nightscout.interfaces.protection.ProtectionCheck.ProtectionType.NONE import info.nightscout.plugins.aps.loop.LoopPlugin import info.nightscout.plugins.constraints.safety.SafetyPlugin import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin +import info.nightscout.plugins.general.wear.WearPlugin import info.nightscout.plugins.general.xdripStatusline.StatusLinePlugin import info.nightscout.plugins.insulin.InsulinOrefFreePeakPlugin import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin @@ -60,6 +59,7 @@ import info.nightscout.plugins.sync.nsclient.NSClientPlugin import info.nightscout.plugins.sync.nsclient.data.NSSettingsStatus import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin import info.nightscout.plugins.sync.tidepool.TidepoolPlugin +import info.nightscout.pump.combo.ComboPlugin import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventPreferenceChange import info.nightscout.rx.events.EventRebuildTabs diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt b/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt index bfffd00d04..2b803a299f 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt @@ -5,7 +5,6 @@ import dagger.Component import dagger.android.AndroidInjectionModule import dagger.android.AndroidInjector import info.nightscout.androidaps.MainApp -import info.nightscout.androidaps.combo.di.ComboModule import info.nightscout.androidaps.combov2.di.ComboV2Module import info.nightscout.androidaps.dana.di.DanaHistoryModule import info.nightscout.androidaps.dana.di.DanaModule @@ -28,6 +27,7 @@ import info.nightscout.database.impl.DatabaseModule import info.nightscout.implementation.di.ImplementationModule import info.nightscout.plugins.aps.di.ApsModule import info.nightscout.plugins.di.PluginsModule +import info.nightscout.pump.combo.di.ComboModule import info.nightscout.rx.di.RxModule import info.nightscout.shared.di.SharedModule import info.nightscout.shared.impl.di.SharedImplModule diff --git a/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt b/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt index 32891ad808..660178e8ae 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt @@ -14,8 +14,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin -import info.nightscout.plugins.general.wear.WearPlugin -import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin import info.nightscout.androidaps.plugins.pump.combov2.ComboV2Plugin import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin @@ -41,6 +39,7 @@ import info.nightscout.plugins.general.dataBroadcaster.DataBroadcastPlugin import info.nightscout.plugins.general.food.FoodPlugin import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin import info.nightscout.plugins.general.themes.ThemeSwitcherPlugin +import info.nightscout.plugins.general.wear.WearPlugin import info.nightscout.plugins.general.xdripStatusline.StatusLinePlugin import info.nightscout.plugins.insulin.InsulinLyumjevPlugin import info.nightscout.plugins.insulin.InsulinOrefFreePeakPlugin @@ -63,6 +62,7 @@ import info.nightscout.plugins.source.XdripPlugin import info.nightscout.plugins.sync.nsclient.NSClientPlugin import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin import info.nightscout.plugins.sync.tidepool.TidepoolPlugin +import info.nightscout.pump.combo.ComboPlugin import info.nightscout.sensitivity.SensitivityAAPSPlugin import info.nightscout.sensitivity.SensitivityOref1Plugin import info.nightscout.sensitivity.SensitivityWeightedAveragePlugin diff --git a/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt b/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt index 2758c88b27..0565341a50 100644 --- a/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt @@ -11,7 +11,10 @@ import info.nightscout.androidaps.activities.HistoryBrowseActivity import info.nightscout.androidaps.activities.MyPreferenceFragment import info.nightscout.androidaps.activities.PreferencesActivity import info.nightscout.androidaps.services.AlarmSoundService +import info.nightscout.core.events.EventNewNotification +import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.rx.bus.RxBus import info.nightscout.ui.activities.BolusProgressHelperActivity import info.nightscout.ui.activities.ErrorHelperActivity import info.nightscout.ui.activities.SingleFragmentActivity @@ -27,7 +30,9 @@ import info.nightscout.ui.dialogs.TempTargetDialog import info.nightscout.ui.dialogs.WizardDialog import javax.inject.Inject -class ActivityNamesImpl @Inject constructor() : ActivityNames { +class ActivityNamesImpl @Inject constructor( + private val rxBus: RxBus +) : ActivityNames { override val mainActivity: Class<*> = MainActivity::class.java override val tddStatsActivity: Class<*> = TDDStatsActivity::class.java @@ -114,4 +119,20 @@ class ActivityNamesImpl @Inject constructor() : ActivityNames { it.show(fragmentManager, "BolusProgress") } } + + override fun addNotification(id: Int, text: String, level: Int) { + rxBus.send(EventNewNotification(Notification(id, text, level))) + } + + override fun addNotificationValidFor(id: Int, text: String, level: Int, validMinutes: Int) { + rxBus.send(EventNewNotification(Notification(id, text, level, validMinutes))) + } + + override fun addNotificationWithSound(id: Int, text: String, level: Int, soundId: Int) { + rxBus.send(EventNewNotification(Notification(id, text, level).also { it.soundId = soundId })) + } + + override fun addNotificationValidTo(id: Int, date: Long, text: String, level: Int, validTo: Long) { + rxBus.send(EventNewNotification(Notification(id, System.currentTimeMillis(), text, level,validTo))) + } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt index c504298267..d7351fd18e 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -12,8 +12,6 @@ import info.nightscout.androidaps.implementations.ConfigImpl import info.nightscout.androidaps.insight.database.InsightDatabaseDao import info.nightscout.androidaps.insight.database.InsightDbHelper import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider -import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.RuffyScripter import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.database.impl.AppRepository import info.nightscout.implementation.constraints.ConstraintsImpl @@ -31,12 +29,15 @@ import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.TemporaryBasalStorage import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.queue.CommandQueue +import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin import info.nightscout.plugins.constraints.objectives.objectives.Objective import info.nightscout.plugins.constraints.safety.SafetyPlugin import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.plugins.source.GlimpPlugin +import info.nightscout.pump.combo.ComboPlugin +import info.nightscout.pump.combo.ruffyscripter.RuffyScripter import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert import org.junit.Before @@ -62,6 +63,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { @Mock lateinit var pumpSync: PumpSync @Mock lateinit var insightDatabaseDao: InsightDatabaseDao @Mock lateinit var ruffyScripter: RuffyScripter + @Mock lateinit var activityNames: ActivityNames private lateinit var hardLimits: HardLimits private lateinit var danaPump: DanaPump @@ -93,7 +95,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { fun prepare() { `when`(rh.gs(R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.") `when`(rh.gs(R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences") - `when`(rh.gs(R.string.novalidbasalrate)).thenReturn("No valid basal rate read from pump") + `when`(rh.gs(info.nightscout.ui.R.string.no_valid_basal_rate)).thenReturn("No valid basal rate read from pump") `when`(rh.gs(R.string.autosens_disabled_in_preferences)).thenReturn("Autosens disabled in preferences") `when`(rh.gs(R.string.smb_disabled_in_preferences)).thenReturn("SMB disabled in preferences") `when`(rh.gs(R.string.pumplimit)).thenReturn("pump limit") @@ -106,7 +108,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { `when`(rh.gs(R.string.hardlimit)).thenReturn("hard limit") `when`(rh.gs(R.string.key_child)).thenReturn("child") `when`(rh.gs(R.string.limitingcarbs)).thenReturn("Limiting carbs to %d g because of %s") - `when`(rh.gs(R.string.limitingiob)).thenReturn("Limiting IOB to %.1f U because of %s") + `when`(rh.gs(info.nightscout.ui.R.string.limiting_iob)).thenReturn("Limiting IOB to %.1f U because of %s") `when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") `when`(rh.gs(R.string.itmustbepositivevalue)).thenReturn("it must be positive value") @@ -132,7 +134,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { insightDbHelper = InsightDbHelper(insightDatabaseDao) danaPump = DanaPump(aapsLogger, sp, dateUtil, injector) objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, config) - comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter) + comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter, activityNames) danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync) danaRSPlugin = DanaRSPlugin( diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/safety/SafetyPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/safety/SafetyPluginTest.kt index 0f69d8f663..86f39ccade 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/safety/SafetyPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/safety/SafetyPluginTest.kt @@ -56,7 +56,7 @@ class SafetyPluginTest : TestBaseWithProfile() { `when`(rh.gs(info.nightscout.plugins.aps.R.string.max_basal_multiplier)).thenReturn("max basal multiplier") `when`(rh.gs(R.string.limitingbolus)).thenReturn("Limiting bolus to %1\$.1f U because of %2\$s") `when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") - `when`(rh.gs(R.string.limitingiob)).thenReturn("Limiting IOB to %1\$.1f U because of %2\$s") + `when`(rh.gs(R.string.limiting_iob)).thenReturn("Limiting IOB to %1\$.1f U because of %2\$s") `when`(rh.gs(R.string.limitingcarbs)).thenReturn("Limiting carbs to %1\$d g because of %2\$s") `when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") `when`(rh.gs(R.string.pumpisnottempbasalcapable)).thenReturn("Pump is not temp basal capable") diff --git a/core/core-main/src/main/java/info/nightscout/core/pump/PumpStateExtension.kt b/core/core-main/src/main/java/info/nightscout/core/pump/PumpStateExtension.kt index f3979103a9..8593995c81 100644 --- a/core/core-main/src/main/java/info/nightscout/core/pump/PumpStateExtension.kt +++ b/core/core-main/src/main/java/info/nightscout/core/pump/PumpStateExtension.kt @@ -10,12 +10,6 @@ import kotlin.math.max import kotlin.math.min import kotlin.math.roundToInt -val PumpSync.PumpState.TemporaryBasal.end: Long - get() = timestamp + duration - -val PumpSync.PumpState.TemporaryBasal.plannedRemainingMinutes: Long - get() = max(T.msecs(end - System.currentTimeMillis()).mins(), 0L) - val PumpSync.PumpState.TemporaryBasal.plannedRemainingMinutesRoundedUp: Int get() = max(ceil((end - System.currentTimeMillis()) / 1000.0 / 60).toInt(), 0) diff --git a/core/core-main/src/main/res/values-af-rZA/strings.xml b/core/core-main/src/main/res/values-af-rZA/strings.xml index 98d4a629a8..3d47b89f6a 100644 --- a/core/core-main/src/main/res/values-af-rZA/strings.xml +++ b/core/core-main/src/main/res/values-af-rZA/strings.xml @@ -33,10 +33,10 @@ Doelwit Basale waarde Inisialiseer tans... - Reeksnommer + Reeksnommer Battery - Laaste verbinding - Laaste bolus + Laaste verbinding + Laaste bolus Daaglikse eenhede Basis basale tempo Tydelike basaal diff --git a/core/core-main/src/main/res/values-bg-rBG/strings.xml b/core/core-main/src/main/res/values-bg-rBG/strings.xml index 05e250416d..905f629e87 100644 --- a/core/core-main/src/main/res/values-bg-rBG/strings.xml +++ b/core/core-main/src/main/res/values-bg-rBG/strings.xml @@ -38,10 +38,10 @@ Целeва КЗ: Базал Инициализация ... - Сериен номер + Сериен номер Батерия - Последна връзка - Последен болус: + Последна връзка + Последен болус: Инсулин за деня Базова базална стойност Временен базал diff --git a/core/core-main/src/main/res/values-ca-rES/strings.xml b/core/core-main/src/main/res/values-ca-rES/strings.xml index 4b101eb402..fcc9ffa9c0 100644 --- a/core/core-main/src/main/res/values-ca-rES/strings.xml +++ b/core/core-main/src/main/res/values-ca-rES/strings.xml @@ -38,10 +38,10 @@ Objectiu Ràtio de basal Inicialitzant... - Nr. de sèrie + Nr. de sèrie Bateria - Última connexió - Darrer bolus + Última connexió + Darrer bolus Unitats diàries Ràtio de basal base Basal temporal diff --git a/core/core-main/src/main/res/values-cs-rCZ/strings.xml b/core/core-main/src/main/res/values-cs-rCZ/strings.xml index 485f0bc5f9..ca3121601e 100644 --- a/core/core-main/src/main/res/values-cs-rCZ/strings.xml +++ b/core/core-main/src/main/res/values-cs-rCZ/strings.xml @@ -45,10 +45,10 @@ Bazál Cílová glykémie Inicializuji ... - Sériové číslo + Sériové číslo Baterie - Poslední spojení - Poslední bolus + Poslední spojení + Poslední bolus Jednotek za den Základní hodnota bazálu Dočasný bazál diff --git a/core/core-main/src/main/res/values-da-rDK/strings.xml b/core/core-main/src/main/res/values-da-rDK/strings.xml index 4e1cc28898..78b2cfac51 100644 --- a/core/core-main/src/main/res/values-da-rDK/strings.xml +++ b/core/core-main/src/main/res/values-da-rDK/strings.xml @@ -43,10 +43,10 @@ Basalrate Blodsukker mål Initialiserer ... - Serienummer + Serienummer Batteri - Seneste forbindelse - Seneste Bolus + Seneste forbindelse + Seneste Bolus Daglige enheder Standard basal rate Midlertidig basal diff --git a/core/core-main/src/main/res/values-de-rDE/strings.xml b/core/core-main/src/main/res/values-de-rDE/strings.xml index 86ca23c0fa..d5c05e8bc3 100644 --- a/core/core-main/src/main/res/values-de-rDE/strings.xml +++ b/core/core-main/src/main/res/values-de-rDE/strings.xml @@ -42,10 +42,10 @@ Basalrate BZ Ziel Initialisierung... - Seriennummer + Seriennummer Batterie - Letzte Verbindung - Letzter Bolus + Letzte Verbindung + Letzter Bolus Tägliche Einheiten Basis-Basalrate TBR diff --git a/core/core-main/src/main/res/values-el-rGR/strings.xml b/core/core-main/src/main/res/values-el-rGR/strings.xml index 2129e49c30..3c2f525c04 100644 --- a/core/core-main/src/main/res/values-el-rGR/strings.xml +++ b/core/core-main/src/main/res/values-el-rGR/strings.xml @@ -34,10 +34,10 @@ Στόχος Βασικός Ρυθμός Παραμετροποίηση... - Serial number + Serial number Μπαταρία - Τελευταία σύνδεση - Τελευταίο Bolus: + Τελευταία σύνδεση + Τελευταίο Bolus: Μονάδες ανά ημέρα Βάση Βασικού Ρυθμού Προσωρινός Ρυθμός diff --git a/core/core-main/src/main/res/values-es-rES/strings.xml b/core/core-main/src/main/res/values-es-rES/strings.xml index 6f237e9e27..48ed91b94d 100644 --- a/core/core-main/src/main/res/values-es-rES/strings.xml +++ b/core/core-main/src/main/res/values-es-rES/strings.xml @@ -45,10 +45,10 @@ Tasa basal Objetivo de glucosa en sangre Iniciando... - Número de serie + Número de serie Batería - Última conexión - Último bolo + Última conexión + Último bolo Unidades diarias Dosis Basal Base Basal temporal diff --git a/core/core-main/src/main/res/values-fr-rFR/strings.xml b/core/core-main/src/main/res/values-fr-rFR/strings.xml index f0ba40fc68..ce8d29a63f 100644 --- a/core/core-main/src/main/res/values-fr-rFR/strings.xml +++ b/core/core-main/src/main/res/values-fr-rFR/strings.xml @@ -45,10 +45,10 @@ Débit de Basal Glycémie cible En cours d\'initialisation... - Numéro de série + Numéro de série Niveau batterie - Dernière connexion - Dernier bolus + Dernière connexion + Dernier bolus Unités quotidiennes Débit de Basal Basal temporaire diff --git a/core/core-main/src/main/res/values-ga-rIE/strings.xml b/core/core-main/src/main/res/values-ga-rIE/strings.xml index f0ed70288f..fc995f0eda 100644 --- a/core/core-main/src/main/res/values-ga-rIE/strings.xml +++ b/core/core-main/src/main/res/values-ga-rIE/strings.xml @@ -27,10 +27,10 @@ Cuspóir Bunaidh ráta Tosaithe ... - Sraithuimhir + Sraithuimhir Ceallraí - Nasc deiridh - Bólas deiridh + Nasc deiridh + Bólas deiridh Aonaid lá Bunaidh ráta bonn Taiscumar diff --git a/core/core-main/src/main/res/values-hr-rHR/strings.xml b/core/core-main/src/main/res/values-hr-rHR/strings.xml index d57cfb798d..1dfdd889a3 100644 --- a/core/core-main/src/main/res/values-hr-rHR/strings.xml +++ b/core/core-main/src/main/res/values-hr-rHR/strings.xml @@ -43,10 +43,10 @@ Bazalna stopa Ciljana razina glukoze u krvi Pokretanje... - Serijski broj + Serijski broj Baterija - Zadnja uspostava veze - Zadnji bolus + Zadnja uspostava veze + Zadnji bolus g Pumpa nedostupna Izlaz diff --git a/core/core-main/src/main/res/values-hu-rHU/strings.xml b/core/core-main/src/main/res/values-hu-rHU/strings.xml index 5b445eee92..ac57fc8b60 100644 --- a/core/core-main/src/main/res/values-hu-rHU/strings.xml +++ b/core/core-main/src/main/res/values-hu-rHU/strings.xml @@ -15,7 +15,7 @@ Cél Bázisütem Inicializálás ... - Sorozatszám + Sorozatszám g % Bluetooth diff --git a/core/core-main/src/main/res/values-it-rIT/strings.xml b/core/core-main/src/main/res/values-it-rIT/strings.xml index 8ee313d80b..38df6b5016 100644 --- a/core/core-main/src/main/res/values-it-rIT/strings.xml +++ b/core/core-main/src/main/res/values-it-rIT/strings.xml @@ -43,10 +43,10 @@ Velocità basale Target glicemia Inizializzazione... - Numero seriale + Numero seriale Batteria - Ultima connessione - Ultimo bolo + Ultima connessione + Ultimo bolo Unità giornaliere Velocità basale originale Basale temporanea diff --git a/core/core-main/src/main/res/values-iw-rIL/strings.xml b/core/core-main/src/main/res/values-iw-rIL/strings.xml index e99056d482..c08ac137f3 100644 --- a/core/core-main/src/main/res/values-iw-rIL/strings.xml +++ b/core/core-main/src/main/res/values-iw-rIL/strings.xml @@ -43,10 +43,10 @@ מינון בזאלי ערך מטרה מאתחל... - מספר סידורי + מספר סידורי סוללה - התחברות אחרונה - בולוס אחרון + התחברות אחרונה + בולוס אחרון יחידות יומיות בזאלי בסיסי בזאלי זמני diff --git a/core/core-main/src/main/res/values-ko-rKR/strings.xml b/core/core-main/src/main/res/values-ko-rKR/strings.xml index 0d40eed160..e708b55a17 100644 --- a/core/core-main/src/main/res/values-ko-rKR/strings.xml +++ b/core/core-main/src/main/res/values-ko-rKR/strings.xml @@ -38,10 +38,10 @@ 목표: Basal양 초기화중 ... - 시리얼번호 + 시리얼번호 배터리 - 마지막 접속 - 최근 Bolus: + 마지막 접속 + 최근 Bolus: 일 인슐린 총량 기본 Basal양 임시Basal diff --git a/core/core-main/src/main/res/values-lt-rLT/strings.xml b/core/core-main/src/main/res/values-lt-rLT/strings.xml index 7b9ef53263..dc14f3cff7 100644 --- a/core/core-main/src/main/res/values-lt-rLT/strings.xml +++ b/core/core-main/src/main/res/values-lt-rLT/strings.xml @@ -40,10 +40,10 @@ Insulino į angliavandenius santykis Valandinė bazė Inicijuojama ... - Serijos numeris + Serijos numeris Baterija - Paskutinis prisijungimas - Paskutinis bolusas + Paskutinis prisijungimas + Paskutinis bolusas Paros insulinas Pagrindinis bazės dydis Laikina bazė diff --git a/core/core-main/src/main/res/values-nl-rNL/strings.xml b/core/core-main/src/main/res/values-nl-rNL/strings.xml index 32585fdc87..727d94a2a6 100644 --- a/core/core-main/src/main/res/values-nl-rNL/strings.xml +++ b/core/core-main/src/main/res/values-nl-rNL/strings.xml @@ -45,10 +45,10 @@ Basaalstand Bloedglucose doelwaarde Initialiseren... - Serie nummer + Serie nummer Batterij - Laatste verbinding - Laatste bolus + Laatste verbinding + Laatste bolus Dag totaal Basis basaalstand Tijdelijk basaal diff --git a/core/core-main/src/main/res/values-no-rNO/strings.xml b/core/core-main/src/main/res/values-no-rNO/strings.xml index 9c93251b1e..17639f9b04 100644 --- a/core/core-main/src/main/res/values-no-rNO/strings.xml +++ b/core/core-main/src/main/res/values-no-rNO/strings.xml @@ -45,10 +45,10 @@ Basalrate Blodsukkermål Starter opp... - Serienummer + Serienummer Batteri - Siste tilkobling - Siste bolus + Siste tilkobling + Siste bolus Daglige enheter Profilens basaldose Temp basal diff --git a/core/core-main/src/main/res/values-pl-rPL/strings.xml b/core/core-main/src/main/res/values-pl-rPL/strings.xml index 64e16c0383..a6893f7fc7 100644 --- a/core/core-main/src/main/res/values-pl-rPL/strings.xml +++ b/core/core-main/src/main/res/values-pl-rPL/strings.xml @@ -38,10 +38,10 @@ Cel Dawka bazowa Inicjuje ... - Numer seryjny + Numer seryjny Bateria - Ostatnie połączenie - Ostatni bolus + Ostatnie połączenie + Ostatni bolus Jednostki dzienne Podstawowa dawka bazowa Baza tymczasowa diff --git a/core/core-main/src/main/res/values-pt-rBR/strings.xml b/core/core-main/src/main/res/values-pt-rBR/strings.xml index ad3e06ccf4..e02b8ee441 100644 --- a/core/core-main/src/main/res/values-pt-rBR/strings.xml +++ b/core/core-main/src/main/res/values-pt-rBR/strings.xml @@ -43,10 +43,10 @@ Taxa basal Alvo de glicemia Inicializando... - Número de série + Número de série Bateria - Última ligação - Último Bolus + Última ligação + Último Bolus Unidades diárias Taxa Basal de base Basal temporaria diff --git a/core/core-main/src/main/res/values-pt-rPT/strings.xml b/core/core-main/src/main/res/values-pt-rPT/strings.xml index 677c487bc8..b10ce26b9a 100644 --- a/core/core-main/src/main/res/values-pt-rPT/strings.xml +++ b/core/core-main/src/main/res/values-pt-rPT/strings.xml @@ -38,10 +38,10 @@ Alvo Taxa da Basal A inicializar ... - Número de série + Número de série Bateria - Última ligação - Último bólus + Última ligação + Último bólus Unidades diárias Taxa Basal de base Basal temp diff --git a/core/core-main/src/main/res/values-ro-rRO/strings.xml b/core/core-main/src/main/res/values-ro-rRO/strings.xml index 5e0d019907..121255fc4e 100644 --- a/core/core-main/src/main/res/values-ro-rRO/strings.xml +++ b/core/core-main/src/main/res/values-ro-rRO/strings.xml @@ -38,10 +38,10 @@ Țintă Rată bazală Inițializare... - Număr serial + Număr serial Baterie - Ultima conexiune - Ultimul bolus + Ultima conexiune + Ultimul bolus Unități zilnic Rată bazală normală Bazală temporară diff --git a/core/core-main/src/main/res/values-ru-rRU/strings.xml b/core/core-main/src/main/res/values-ru-rRU/strings.xml index 7a9d5be801..1cf5dde8c2 100644 --- a/core/core-main/src/main/res/values-ru-rRU/strings.xml +++ b/core/core-main/src/main/res/values-ru-rRU/strings.xml @@ -45,10 +45,10 @@ Базальная скорость Целевая ГК инициализация... - Серийный номер + Серийный номер батарея - прошлое соединение - предыдущий болюс + прошлое соединение + предыдущий болюс суточные единицы базовая величина базала врем базал diff --git a/core/core-main/src/main/res/values-sk-rSK/strings.xml b/core/core-main/src/main/res/values-sk-rSK/strings.xml index d387c80c90..fb8b3970dc 100644 --- a/core/core-main/src/main/res/values-sk-rSK/strings.xml +++ b/core/core-main/src/main/res/values-sk-rSK/strings.xml @@ -45,10 +45,10 @@ Bazál Cieľová glykémia Inicializácia ... - Sériové číslo + Sériové číslo Batéria - Posledné spojenie - Posledný bolus + Posledné spojenie + Posledný bolus Jednotiek za deň Základná hodnota bazálu Dočasný bazál diff --git a/core/core-main/src/main/res/values-sv-rSE/strings.xml b/core/core-main/src/main/res/values-sv-rSE/strings.xml index 57754e4f72..c374d3ea5f 100644 --- a/core/core-main/src/main/res/values-sv-rSE/strings.xml +++ b/core/core-main/src/main/res/values-sv-rSE/strings.xml @@ -42,10 +42,10 @@ Basaldos Mål-BG Startar... - Serienummer + Serienummer Batterinivå - Senast ansluten - Senaste bolus + Senast ansluten + Senaste bolus Enheter per dag Profilens basaldos Temp basal diff --git a/core/core-main/src/main/res/values-tr-rTR/strings.xml b/core/core-main/src/main/res/values-tr-rTR/strings.xml index 8aa9ed3483..546a92c183 100644 --- a/core/core-main/src/main/res/values-tr-rTR/strings.xml +++ b/core/core-main/src/main/res/values-tr-rTR/strings.xml @@ -45,10 +45,10 @@ Bazal oranı Kan Şekeri Hedefi Başlatılıyor ... - Seri numarası + Seri numarası Pil - Son bağlantı - Son bolus + Son bağlantı + Son bolus Günlük ünite Temel bazal oranı Geçici Bazal diff --git a/core/core-main/src/main/res/values-zh-rCN/strings.xml b/core/core-main/src/main/res/values-zh-rCN/strings.xml index c16a258bbc..65ccb06b13 100644 --- a/core/core-main/src/main/res/values-zh-rCN/strings.xml +++ b/core/core-main/src/main/res/values-zh-rCN/strings.xml @@ -42,10 +42,10 @@ 基础率 血糖目标 正在初始化 - 序列号 + 序列号 电池 - 上次连接 - 上次大剂量 + 上次连接 + 上次大剂量 每日单位数 基础率 临时基础率 diff --git a/core/core-main/src/main/res/values/strings.xml b/core/core-main/src/main/res/values/strings.xml index 98ff64a64e..a740529e53 100644 --- a/core/core-main/src/main/res/values/strings.xml +++ b/core/core-main/src/main/res/values/strings.xml @@ -1,10 +1,8 @@ - Refresh Save Not set - Failed to update basal profile Tempbasal delivery error Going to deliver %1$.2f U Waiting for pump @@ -14,7 +12,6 @@ %1$+.2f U %1$d g %1$.0f / %2$d U - %1$.2f U/h %1$.2f h %1$d mins Pump is busy @@ -41,15 +38,7 @@ Basal rate Blood Glucose Target Initializing ... - Serial number - Battery - Last connection - Last bolus Daily units - Base basal rate - Temp basal - Extended bolus - Reservoir Pump history View profile Event type @@ -62,13 +51,7 @@ BT Watchdog Switches off the phone\'s bluetooth for one second if no connection to the pump is possible. This may help on some phones where the bluetooth stack freezes. Pairing - LOOP DISABLED BY CONSTRAINTS - Bolus %1$.2f U delivered successfully OK - No valid basal rate read from pump - Limiting max IOB to %1$.1f U because of %2$s - unsafe usage - Pump unreachable Extended bolus Pump time updated Exit @@ -161,7 +144,6 @@ Limiting max percent rate to %1$d%% because of %2$s it must be positive value Limiting bolus to %1$.1f U because of %2$s - Pump not initialized, profile not set! Bluetooth Low Energy not supported. @@ -260,7 +242,6 @@ Percent Absolute Insulin - U Waiting for result SMB @@ -464,7 +445,6 @@ Scheduled Status Refresh Unconfirmed command Requested by user - User request Bolus OK Pump paired Insight Refresh Button diff --git a/core/core-main/src/main/res/drawable/ic_actions_refill.xml b/core/ui/src/main/res/drawable/ic_actions_refill.xml similarity index 100% rename from core/core-main/src/main/res/drawable/ic_actions_refill.xml rename to core/ui/src/main/res/drawable/ic_actions_refill.xml diff --git a/core/core-main/src/main/res/drawable/ic_combo_128.xml b/core/ui/src/main/res/drawable/ic_combo_128.xml similarity index 100% rename from core/core-main/src/main/res/drawable/ic_combo_128.xml rename to core/ui/src/main/res/drawable/ic_combo_128.xml diff --git a/core/core-main/src/main/res/drawable/ic_danai_128.xml b/core/ui/src/main/res/drawable/ic_danai_128.xml similarity index 100% rename from core/core-main/src/main/res/drawable/ic_danai_128.xml rename to core/ui/src/main/res/drawable/ic_danai_128.xml diff --git a/core/core-main/src/main/res/drawable/ic_danars_128.xml b/core/ui/src/main/res/drawable/ic_danars_128.xml similarity index 100% rename from core/core-main/src/main/res/drawable/ic_danars_128.xml rename to core/ui/src/main/res/drawable/ic_danars_128.xml diff --git a/core/core-main/src/main/res/drawable/ic_insight_128.xml b/core/ui/src/main/res/drawable/ic_insight_128.xml similarity index 100% rename from core/core-main/src/main/res/drawable/ic_insight_128.xml rename to core/ui/src/main/res/drawable/ic_insight_128.xml diff --git a/core/core-main/src/main/res/drawable/ic_pod_128.xml b/core/ui/src/main/res/drawable/ic_pod_128.xml similarity index 100% rename from core/core-main/src/main/res/drawable/ic_pod_128.xml rename to core/ui/src/main/res/drawable/ic_pod_128.xml diff --git a/core/core-main/src/main/res/drawable/ic_veo_128.xml b/core/ui/src/main/res/drawable/ic_veo_128.xml similarity index 100% rename from core/core-main/src/main/res/drawable/ic_veo_128.xml rename to core/ui/src/main/res/drawable/ic_veo_128.xml diff --git a/core/core-main/src/main/res/raw/alarm.mp3 b/core/ui/src/main/res/raw/alarm.mp3 similarity index 100% rename from core/core-main/src/main/res/raw/alarm.mp3 rename to core/ui/src/main/res/raw/alarm.mp3 diff --git a/core/core-main/src/main/res/raw/boluserror.mp3 b/core/ui/src/main/res/raw/boluserror.mp3 similarity index 100% rename from core/core-main/src/main/res/raw/boluserror.mp3 rename to core/ui/src/main/res/raw/boluserror.mp3 diff --git a/core/ui/src/main/res/values/strings.xml b/core/ui/src/main/res/values/strings.xml index 1e029863c3..f8183252f9 100644 --- a/core/ui/src/main/res/values/strings.xml +++ b/core/ui/src/main/res/values/strings.xml @@ -1,6 +1,7 @@ + Refresh Error Basal profile in pump updated Invalid input data @@ -8,6 +9,25 @@ Constraint applied! Total IOB: TT + Pump unreachable + U + %1$.2f U/h + Pump not initialized, profile not set! + Failed to update basal profile + Bolus %1$.2f U delivered successfully + No valid basal rate read from pump + Limiting IOB to %1$.1f U because of %2$s + LOOP DISABLED BY CONSTRAINTS + + + Battery + Reservoir + Last connection + Last bolus + Base basal rate + Temp basal + Extended bolus + Serial number language @@ -37,4 +57,7 @@ Application needs bluetooth permission + + User request + \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/overview/OverviewDataImpl.kt b/implementation/src/main/java/info/nightscout/implementation/overview/OverviewDataImpl.kt index f74af7fc9f..cfc15a72df 100644 --- a/implementation/src/main/java/info/nightscout/implementation/overview/OverviewDataImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/overview/OverviewDataImpl.kt @@ -166,16 +166,16 @@ class OverviewDataImpl @Inject constructor( var temporaryBasal = iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now()) if (temporaryBasal?.isInProgress == false) temporaryBasal = null temporaryBasal?.let { "T:" + it.toStringShort() } - ?: rh.gs(R.string.pump_basebasalrate, profile.getBasal()) + ?: rh.gs(R.string.pump_base_basal_rate, profile.getBasal()) } ?: rh.gs(R.string.value_unavailable_short) override fun temporaryBasalDialogText(iobCobCalculator: IobCobCalculator): String = profileFunction.getProfile()?.let { profile -> iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now())?.let { temporaryBasal -> - "${rh.gs(R.string.base_basal_rate_label)}: ${rh.gs(R.string.pump_basebasalrate, profile.getBasal())}" + + "${rh.gs(R.string.base_basal_rate_label)}: ${rh.gs(R.string.pump_base_basal_rate, profile.getBasal())}" + "\n" + rh.gs(R.string.tempbasal_label) + ": " + temporaryBasal.toStringFull(profile, dateUtil) } - ?: "${rh.gs(R.string.base_basal_rate_label)}: ${rh.gs(R.string.pump_basebasalrate, profile.getBasal())}" + ?: "${rh.gs(R.string.base_basal_rate_label)}: ${rh.gs(R.string.pump_base_basal_rate, profile.getBasal())}" } ?: rh.gs(R.string.value_unavailable_short) @DrawableRes override fun temporaryBasalIcon(iobCobCalculator: IobCobCalculator): Int = @@ -205,7 +205,7 @@ class OverviewDataImpl @Inject constructor( override fun extendedBolusText(iobCobCalculator: IobCobCalculator): String = iobCobCalculator.getExtendedBolus(dateUtil.now())?.let { extendedBolus -> if (!extendedBolus.isInProgress(dateUtil)) "" - else if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) rh.gs(R.string.pump_basebasalrate, extendedBolus.rate) + else if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) rh.gs(R.string.pump_base_basal_rate, extendedBolus.rate) else "" } ?: "" diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt index 7962ee7e9e..c20bec8f63 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt @@ -117,7 +117,7 @@ class CommandQueueImplementation @Inject constructor( setProfile(ProfileSealed.PS(it), it.interfaceIDs.nightscoutId != null, object : Callback() { override fun run() { if (!result.success) { - activityNames.runAlarm(context, result.comment, rh.gs(R.string.failedupdatebasalprofile), R.raw.boluserror) + activityNames.runAlarm(context, result.comment, rh.gs(R.string.failed_update_basal_profile), R.raw.boluserror) } else { val nonCustomized = ProfileSealed.PS(it).convertToNonCustomizedProfile(dateUtil) EffectiveProfileSwitch( diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java index e661a8fe97..6d0265a90e 100644 --- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java +++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java @@ -508,17 +508,17 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight, } } catch (AppLayerErrorException e) { aapsLogger.info(LTag.PUMP, "Exception while setting profile: " + e.getClass().getCanonicalName() + " (" + e.getErrorCode() + ")"); - Notification notification = new Notification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failedupdatebasalprofile), Notification.URGENT); + Notification notification = new Notification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failed_update_basal_profile), Notification.URGENT); rxBus.send(new EventNewNotification(notification)); result.comment(ExceptionTranslator.getString(context, e)); } catch (InsightException e) { aapsLogger.info(LTag.PUMP, "Exception while setting profile: " + e.getClass().getCanonicalName()); - Notification notification = new Notification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failedupdatebasalprofile), Notification.URGENT); + Notification notification = new Notification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failed_update_basal_profile), Notification.URGENT); rxBus.send(new EventNewNotification(notification)); result.comment(ExceptionTranslator.getString(context, e)); } catch (Exception e) { aapsLogger.error("Exception while setting profile", e); - Notification notification = new Notification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failedupdatebasalprofile), Notification.URGENT); + Notification notification = new Notification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failed_update_basal_profile), Notification.URGENT); rxBus.send(new EventNewNotification(notification)); result.comment(ExceptionTranslator.getString(context, e)); } @@ -968,7 +968,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight, if (tb != null) { extended.put("TempBasalAbsoluteRate", convertedToAbsolute(tb, now, profile)); extended.put("TempBasalStart", dateUtil.dateAndTimeString(tb.getTimestamp())); - extended.put("TempBasalRemaining", getPlannedRemainingMinutes(tb)); + extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes()); } PumpSync.PumpState.ExtendedBolus eb = pumpSync.expectedPumpState().getExtendedBolus(); if (eb != null) { diff --git a/insight/src/main/res/layout/activity_insight_pairing_information.xml b/insight/src/main/res/layout/activity_insight_pairing_information.xml index 9910d78027..00470630fd 100644 --- a/insight/src/main/res/layout/activity_insight_pairing_information.xml +++ b/insight/src/main/res/layout/activity_insight_pairing_information.xml @@ -13,7 +13,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="16sp" - android:text="@string/serialnumber" /> + android:text="@string/serial_number" /> ): Constraint { if (isEnabled()) { val maxIobPref: Double = sp.getDouble(R.string.key_openapsma_max_iob, 1.5) - maxIob.setIfSmaller(aapsLogger, maxIobPref, rh.gs(R.string.limitingiob, maxIobPref, rh.gs(R.string.maxvalueinpreferences)), this) - maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobAMA(), rh.gs(R.string.limitingiob, hardLimits.maxIobAMA(), rh.gs(R.string.hardlimit)), this) + maxIob.setIfSmaller(aapsLogger, maxIobPref, rh.gs(R.string.limiting_iob, maxIobPref, rh.gs(R.string.maxvalueinpreferences)), this) + maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobAMA(), rh.gs(R.string.limiting_iob, hardLimits.maxIobAMA(), rh.gs(R.string.hardlimit)), this) } return maxIob } diff --git a/plugins/aps/src/main/java/info/nightscout/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt b/plugins/aps/src/main/java/info/nightscout/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt index d669a6c74a..3d0be65374 100644 --- a/plugins/aps/src/main/java/info/nightscout/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt +++ b/plugins/aps/src/main/java/info/nightscout/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt @@ -241,8 +241,8 @@ class OpenAPSSMBPlugin @Inject constructor( override fun applyMaxIOBConstraints(maxIob: Constraint): Constraint { if (isEnabled()) { val maxIobPref: Double = sp.getDouble(R.string.key_openapssmb_max_iob, 3.0) - maxIob.setIfSmaller(aapsLogger, maxIobPref, rh.gs(R.string.limitingiob, maxIobPref, rh.gs(R.string.maxvalueinpreferences)), this) - maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobSMB(), rh.gs(R.string.limitingiob, hardLimits.maxIobSMB(), rh.gs(R.string.hardlimit)), this) + maxIob.setIfSmaller(aapsLogger, maxIobPref, rh.gs(R.string.limiting_iob, maxIobPref, rh.gs(R.string.maxvalueinpreferences)), this) + maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobSMB(), rh.gs(R.string.limiting_iob, hardLimits.maxIobSMB(), rh.gs(R.string.hardlimit)), this) } return maxIob } diff --git a/plugins/aps/src/main/res/values/strings.xml b/plugins/aps/src/main/res/values/strings.xml index f9e51aebb2..a9df533db6 100644 --- a/plugins/aps/src/main/res/values/strings.xml +++ b/plugins/aps/src/main/res/values/strings.xml @@ -115,7 +115,7 @@ Autosens disabled in preferences - Limiting IOB to %1$.1f U because of %2$s + Limiting IOB to %1$.1f U because of %2$s max value in preferences hard limit diff --git a/plugins/main/src/main/java/info/nightscout/plugins/aps/loop/LoopPlugin.kt b/plugins/main/src/main/java/info/nightscout/plugins/aps/loop/LoopPlugin.kt index 5daf1cd392..dfbb894744 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/aps/loop/LoopPlugin.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/aps/loop/LoopPlugin.kt @@ -224,7 +224,7 @@ class LoopPlugin @Inject constructor( val loopEnabled = constraintChecker.isLoopInvocationAllowed() if (!loopEnabled.value()) { val message = """ - ${rh.gs(R.string.loopdisabled)} + ${rh.gs(R.string.loop_disabled)} ${loopEnabled.getReasons(aapsLogger)} """.trimIndent() aapsLogger.debug(LTag.APS, message) diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/safety/SafetyPlugin.kt b/plugins/main/src/main/java/info/nightscout/plugins/constraints/safety/SafetyPlugin.kt index 674d510307..1803a361d9 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/safety/SafetyPlugin.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/constraints/safety/SafetyPlugin.kt @@ -160,7 +160,7 @@ class SafetyPlugin @Inject constructor( override fun applyMaxIOBConstraints(maxIob: Constraint): Constraint { val apsMode = sp.getString(R.string.key_aps_mode, "open") - if (apsMode == "lgs") maxIob.setIfSmaller(aapsLogger, HardLimits.MAX_IOB_LGS, rh.gs(R.string.limitingiob, HardLimits.MAX_IOB_LGS, rh.gs(R.string.lowglucosesuspend)), this) + if (apsMode == "lgs") maxIob.setIfSmaller(aapsLogger, HardLimits.MAX_IOB_LGS, rh.gs(R.string.limiting_iob, HardLimits.MAX_IOB_LGS, rh.gs(R.string.lowglucosesuspend)), this) return maxIob } diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/wear/wearintegration/DataHandlerMobile.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/wear/wearintegration/DataHandlerMobile.kt index fe8421b89c..8056f670f5 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/wear/wearintegration/DataHandlerMobile.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/wear/wearintegration/DataHandlerMobile.kt @@ -886,7 +886,7 @@ class DataHandlerMobile @Inject constructor( iobSum = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) iobDetail = "(${DecimalFormatter.to2Decimal(bolusIob.iob)}|${DecimalFormatter.to2Decimal(basalIob.basaliob)})" cobString = iobCobCalculator.getCobInfo(false, "WatcherUpdaterService").generateCOBString() - currentBasal = iobCobCalculator.getTempBasalIncludingConvertedExtended(System.currentTimeMillis())?.toStringShort() ?: rh.gs(R.string.pump_basebasalrate, profile.getBasal()) + currentBasal = iobCobCalculator.getTempBasalIncludingConvertedExtended(System.currentTimeMillis())?.toStringShort() ?: rh.gs(R.string.pump_base_basal_rate, profile.getBasal()) //bgi val bgi = -(bolusIob.activity + basalIob.activity) * 5 * Profile.fromMgdlToUnits(profile.getIsfMgdl(), profileFunction.getUnits()) diff --git a/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpFragment.kt b/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpFragment.kt index 7b5f73ff8e..344f9678f7 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpFragment.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpFragment.kt @@ -90,7 +90,7 @@ class VirtualPumpFragment : DaggerFragment() { private fun updateGui() { if (_binding == null) return val profile = profileFunction.getProfile() ?: return - binding.baseBasalRate.text = rh.gs(R.string.pump_basebasalrate, virtualPumpPlugin.baseBasalRate) + binding.baseBasalRate.text = rh.gs(R.string.pump_base_basal_rate, virtualPumpPlugin.baseBasalRate) binding.tempbasal.text = iobCobCalculator.getTempBasal(dateUtil.now())?.toStringFull(profile, dateUtil) ?: "" binding.extendedbolus.text = iobCobCalculator.getExtendedBolus(dateUtil.now())?.toStringFull(dateUtil) diff --git a/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt b/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt index 3f19bf33cd..b6cc15a090 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt @@ -198,7 +198,7 @@ open class VirtualPumpPlugin @Inject constructor( .comment(rh.gs(R.string.stop)) } SystemClock.sleep(200) - bolusingEvent.status = rh.gs(R.string.bolusdelivered, detailedBolusInfo.insulin) + bolusingEvent.status = rh.gs(R.string.bolus_delivered, detailedBolusInfo.insulin) bolusingEvent.percent = 100 rxBus.send(bolusingEvent) SystemClock.sleep(1000) diff --git a/plugins/main/src/main/res/layout/virtual_pump_fragment.xml b/plugins/main/src/main/res/layout/virtual_pump_fragment.xml index 5915b3dd83..33d875cf98 100644 --- a/plugins/main/src/main/res/layout/virtual_pump_fragment.xml +++ b/plugins/main/src/main/res/layout/virtual_pump_fragment.xml @@ -274,7 +274,7 @@ android:layout_weight="1" android:paddingStart="0dp" android:paddingEnd="5dp" - android:text="@string/serialnumber" + android:text="@string/serial_number" android:textAlignment="viewEnd" android:textSize="14sp" /> diff --git a/plugins/main/src/main/res/values-de-rDE/strings.xml b/plugins/main/src/main/res/values-de-rDE/strings.xml index 0f86e7d774..9bd91932bc 100644 --- a/plugins/main/src/main/res/values-de-rDE/strings.xml +++ b/plugins/main/src/main/res/values-de-rDE/strings.xml @@ -53,7 +53,7 @@ Begrenze verzögerten Bolus auf %1$.1f IE wegen %2$s Begrenze Kohlenhydrate auf %1$d g wegen %2$s - Begrenze IOB auf %1$.1f IE wegen %2$s + Begrenze IOB auf %1$.1f IE wegen %2$s Pumpe verfügt nicht über temporäre Basalraten Closed-Loop-Modus in den Einstellungen deaktiviert Entwickler-Version, Closed Loop ist nicht verfügbar. diff --git a/plugins/main/src/main/res/values-it-rIT/strings.xml b/plugins/main/src/main/res/values-it-rIT/strings.xml index 804da71454..1cd80f3789 100644 --- a/plugins/main/src/main/res/values-it-rIT/strings.xml +++ b/plugins/main/src/main/res/values-it-rIT/strings.xml @@ -141,7 +141,7 @@ Limitazione bolo esteso a %1$.1f U a causa di: %2$s Limitazione carboidrati a %1$d g a causa di: %2$s - Limitazione IOB a %1$.1f U a causa di: %2$s + Limitazione IOB a %1$.1f U a causa di: %2$s Micro non in grado di impostare la basale temporanea Modalità loop chiuso disabilitata nelle preferenze Versione sviluppatore in esecuzione. Loop chiuso disabilitato. diff --git a/plugins/main/src/main/res/values-pt-rBR/strings.xml b/plugins/main/src/main/res/values-pt-rBR/strings.xml index ce4476ba98..2c8c2b1c01 100644 --- a/plugins/main/src/main/res/values-pt-rBR/strings.xml +++ b/plugins/main/src/main/res/values-pt-rBR/strings.xml @@ -48,7 +48,7 @@ A limitar bólus estendido para %1$.1f U porque %2$s A limitar hidratos para %1$d g porque %2$s - A limitar IOB para %1$.1f U porque %2$s + A limitar IOB para %1$.1f U porque %2$s A bomba não é capaz de basais temporárias Loop fecchado disabilitado nas preferências A correr a versão dev. O Loop fechado está desabilitado. diff --git a/plugins/main/src/main/res/values/strings.xml b/plugins/main/src/main/res/values/strings.xml index 400592232f..a79ec11cdb 100644 --- a/plugins/main/src/main/res/values/strings.xml +++ b/plugins/main/src/main/res/values/strings.xml @@ -273,7 +273,6 @@ Limiting extended bolus to %1$.1f U because of %2$s Limiting carbs to %1$d g because of %2$s - Limiting IOB to %1$.1f U because of %2$s Safety Pump is not temp basal capable diff --git a/pump/combo/build.gradle b/pump/combo/build.gradle index c8f482ed93..65352217a5 100644 --- a/pump/combo/build.gradle +++ b/pump/combo/build.gradle @@ -12,15 +12,18 @@ apply from: "${project.rootDir}/core/core-main/allopen_dependencies.gradle" apply from: "${project.rootDir}/core/core-main/test_dependencies.gradle" apply from: "${project.rootDir}/core/core-main/jacoco_global.gradle" android { - namespace 'info.nightscout.androidaps.combo' + namespace 'info.nightscout.pump.combo' } dependencies { implementation project(':libraries') - implementation project(':core:core-main') implementation project(':core:ui') implementation project(':core:utils') implementation project(':app-wear-shared:rx') implementation project(':app-wear-shared:shared') implementation project(':interfaces') + + // RuffyScripter + api 'com.google.guava:guava:31.1-jre' + } \ No newline at end of file diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.kt b/pump/combo/src/main/java/info/nightscout/pump/combo/ComboFragment.kt similarity index 95% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.kt rename to pump/combo/src/main/java/info/nightscout/pump/combo/ComboFragment.kt index b3f32e93d8..5b0f1d6777 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.kt +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ComboFragment.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo +package info.nightscout.pump.combo import android.annotation.SuppressLint import android.graphics.Color @@ -8,15 +8,14 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import dagger.android.support.DaggerFragment -import info.nightscout.androidaps.combo.R -import info.nightscout.androidaps.combo.databinding.CombopumpFragmentBinding -import info.nightscout.androidaps.plugins.pump.combo.data.ComboErrorUtil -import info.nightscout.androidaps.plugins.pump.combo.data.ComboErrorUtil.DisplayType -import info.nightscout.androidaps.plugins.pump.combo.events.EventComboPumpUpdateGUI -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpState import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CommandQueue +import info.nightscout.pump.combo.data.ComboErrorUtil +import info.nightscout.pump.combo.data.ComboErrorUtil.DisplayType +import info.nightscout.pump.combo.databinding.CombopumpFragmentBinding +import info.nightscout.pump.combo.events.EventComboPumpUpdateGUI +import info.nightscout.pump.combo.ruffyscripter.PumpState import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.events.EventQueueChanged @@ -204,7 +203,7 @@ class ComboFragment : DaggerFragment() { } // base basal rate - binding.comboBaseBasalRate.text = rh.gs(R.string.pump_basebasalrate, comboPlugin.baseBasalRate) + binding.comboBaseBasalRate.text = rh.gs(R.string.pump_base_basal_rate, comboPlugin.baseBasalRate) // TBR var tbrStr = "" diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ComboPlugin.java similarity index 90% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ComboPlugin.java index 3b0f95380a..aeefff0687 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ComboPlugin.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo; +package info.nightscout.pump.combo; import android.os.SystemClock; @@ -20,22 +20,6 @@ import javax.inject.Inject; import javax.inject.Singleton; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.combo.R; -import info.nightscout.androidaps.plugins.pump.combo.events.EventComboPumpUpdateGUI; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BasalProfile; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BolusProgressReporter; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.CommandResult; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpState; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpWarningCodes; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.RuffyCommands; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.RuffyScripter; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.WarningOrErrorCode; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Bolus; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpHistory; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpHistoryRequest; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Tdd; -import info.nightscout.core.events.EventNewNotification; -import info.nightscout.core.pump.PumpStateExtensionKt; import info.nightscout.core.utils.fabric.InstanceId; import info.nightscout.interfaces.constraints.Constraint; import info.nightscout.interfaces.constraints.Constraints; @@ -53,6 +37,20 @@ import info.nightscout.interfaces.pump.defs.ManufacturerType; import info.nightscout.interfaces.pump.defs.PumpDescription; import info.nightscout.interfaces.pump.defs.PumpType; import info.nightscout.interfaces.queue.CommandQueue; +import info.nightscout.interfaces.ui.ActivityNames; +import info.nightscout.pump.combo.events.EventComboPumpUpdateGUI; +import info.nightscout.pump.combo.ruffyscripter.BasalProfile; +import info.nightscout.pump.combo.ruffyscripter.BolusProgressReporter; +import info.nightscout.pump.combo.ruffyscripter.CommandResult; +import info.nightscout.pump.combo.ruffyscripter.PumpState; +import info.nightscout.pump.combo.ruffyscripter.PumpWarningCodes; +import info.nightscout.pump.combo.ruffyscripter.RuffyCommands; +import info.nightscout.pump.combo.ruffyscripter.RuffyScripter; +import info.nightscout.pump.combo.ruffyscripter.WarningOrErrorCode; +import info.nightscout.pump.combo.ruffyscripter.history.Bolus; +import info.nightscout.pump.combo.ruffyscripter.history.PumpHistory; +import info.nightscout.pump.combo.ruffyscripter.history.PumpHistoryRequest; +import info.nightscout.pump.combo.ruffyscripter.history.Tdd; import info.nightscout.rx.bus.RxBus; import info.nightscout.rx.events.EventDismissNotification; import info.nightscout.rx.events.EventInitializationChanged; @@ -97,6 +95,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { private final PumpSync pumpSync; private final DateUtil dateUtil; private final RuffyCommands ruffyScripter; + private final ActivityNames activityNames; private final static PumpDescription pumpDescription = new PumpDescription(); @@ -151,7 +150,8 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { CommandQueue commandQueue, PumpSync pumpSync, DateUtil dateUtil, - RuffyScripter ruffyScripter + RuffyScripter ruffyScripter, + ActivityNames activitynames ) { super(new PluginDescription() .mainType(PluginType.PUMP) @@ -170,6 +170,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { this.pumpSync = pumpSync; this.dateUtil = dateUtil; this.ruffyScripter = ruffyScripter; + this.activityNames = activitynames; pumpDescription.fillFor(PumpType.ACCU_CHEK_COMBO); } @@ -197,7 +198,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { } else if (!pump.initialized) { return getRh().gs(R.string.combo_pump_state_initializing); } else if (!validBasalRateProfileSelectedOnPump) { - return getRh().gs(R.string.loopdisabled); + return getRh().gs(R.string.loop_disabled); } return getRh().gs(R.string.combo_pump_state_running); } @@ -261,9 +262,8 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { // note that this should not happen anymore since the queue is present, which // issues a READSTATE when starting to issue commands which initializes the pump getAapsLogger().error("setNewBasalProfile not initialized"); - Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, getRh().gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT); - rxBus.send(new EventNewNotification(notification)); - return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(R.string.pumpNotInitializedProfileNotSet); + activityNames.addNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, getRh().gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT); + return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(R.string.pump_not_initialized_profile_not_set); } BasalProfile requestedBasalProfile = convertProfileToComboProfile(profile); @@ -282,9 +282,8 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { CommandResult setResult = runCommand(getRh().gs(R.string.combo_activity_setting_basal_profile), 2, () -> ruffyScripter.setBasalProfile(requestedBasalProfile)); if (!setResult.success) { - Notification notification = new Notification(Notification.FAILED_UPDATE_PROFILE, getRh().gs(R.string.failedupdatebasalprofile), Notification.URGENT); - rxBus.send(new EventNewNotification(notification)); - return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(R.string.failedupdatebasalprofile); + activityNames.addNotification(Notification.FAILED_UPDATE_PROFILE, getRh().gs(R.string.failed_update_basal_profile), Notification.URGENT); + return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(R.string.failed_update_basal_profile); } pump.basalProfile = requestedBasalProfile; @@ -293,8 +292,8 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)); rxBus.send(new EventDismissNotification(Notification.FAILED_UPDATE_PROFILE)); //issue success notification - Notification notification = new Notification(Notification.PROFILE_SET_OK, getRh().gs(R.string.profile_set_ok), Notification.INFO, 60); - rxBus.send(new EventNewNotification(notification)); + activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, + getRh().gs(R.string.profile_set_ok), Notification.INFO, 60); return new PumpEnactResult(getInjector()).success(true).enacted(true); } @@ -367,8 +366,9 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { // trigger a connect, which will update state and check history CommandResult stateResult = runCommand(null, 1, ruffyScripter::readPumpState); if (stateResult.invalidSetup) { - rxBus.send(new EventNewNotification( - new Notification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_invalid_setup), Notification.URGENT))); + activityNames.addNotification(Notification.COMBO_PUMP_ALARM, + getRh().gs(R.string.combo_invalid_setup), + Notification.URGENT); return; } if (!stateResult.success) { @@ -383,11 +383,9 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { } if (stateResult.state.unsafeUsageDetected == PumpState.UNSUPPORTED_BASAL_RATE_PROFILE) { - Notification n = new Notification(Notification.COMBO_PUMP_ALARM, + activityNames.addNotificationWithSound(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_force_disabled_notification), - Notification.URGENT); - n.setSoundId(R.raw.alarm); - rxBus.send(new EventNewNotification(n)); + Notification.URGENT, R.raw.alarm); return; } @@ -408,8 +406,9 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { long lastBolusTimestamp = recentBoluses.get(0).timestamp; long now = System.currentTimeMillis(); if (lastBolusTimestamp < now - 24 * 60 * 60 * 1000 || lastBolusTimestamp > now + 5 * 60 * 1000) { - Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_check_date), Notification.URGENT); - rxBus.send(new EventNewNotification(notification)); + activityNames.addNotification(Notification.COMBO_PUMP_ALARM, + getRh().gs(R.string.combo_check_date), + Notification.URGENT); } } @@ -480,7 +479,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { event.setStatus(getRh().gs(R.string.bolus_delivering, delivered)); break; case DELIVERED: - event.setStatus(getRh().gs(R.string.bolusdelivered, delivered)); + event.setStatus(getRh().gs(R.string.bolus_delivered, delivered)); break; case STOPPING: event.setStatus(getRh().gs(R.string.bolusstopping)); @@ -607,8 +606,8 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { // check pump bolus record has a sane timestamp long now = System.currentTimeMillis(); if (lastPumpBolus.timestamp < now - 10 * 60 * 1000 || lastPumpBolus.timestamp > now + 10 * 60 * 1000) { - Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_suspious_bolus_time), Notification.URGENT); - rxBus.send(new EventNewNotification(notification)); + activityNames.addNotification(Notification.COMBO_PUMP_ALARM, + getRh().gs(R.string.combo_suspious_bolus_time), Notification.URGENT); } // update `recentBoluses` so the bolus was just delivered won't be detected as a new @@ -676,8 +675,8 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { } catch (Exception e) { getAapsLogger().error("Adding treatment record failed", e); if (detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB) { - Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_error_updating_treatment_record), Notification.URGENT); - rxBus.send(new EventNewNotification(notification)); + activityNames.addNotification(Notification.COMBO_PUMP_ALARM, + getRh().gs(R.string.combo_error_updating_treatment_record), Notification.URGENT); } return false; } @@ -829,15 +828,16 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { } else if (activeTemp == null) { return new PumpEnactResult(getInjector()).success(true).enacted(false); } else if ((activeTemp.getRate() >= 90 && activeTemp.getRate() <= 110) - && PumpStateExtensionKt.getPlannedRemainingMinutes(activeTemp) <= 15) { + && activeTemp.getPlannedRemainingMinutes() <= 15) { // Let fake neutral temp keep run (see below) // Note that since this runs on the queue a connection is opened regardless, but this // case doesn't occur all that often, so it's not worth optimizing (1.3k SetTBR vs 4 cancelTBR). - getAapsLogger().debug(LTag.PUMP, "cancelTempBasal: skipping changing tbr since it already is at " + activeTemp.getRate() + "% and running for another " + PumpStateExtensionKt.getPlannedRemainingMinutes(activeTemp) + " mins."); + getAapsLogger().debug(LTag.PUMP, "cancelTempBasal: skipping changing tbr since it " + + "already is at " + activeTemp.getRate() + "% and running for another " + activeTemp.getPlannedRemainingMinutes() + " mins."); return new PumpEnactResult(getInjector()).success(true).enacted(true) .comment("cancelTempBasal skipping changing tbr since it already is at " + activeTemp.getRate() + "% and running for another " - + PumpStateExtensionKt.getPlannedRemainingMinutes(activeTemp) + " mins."); + + activeTemp.getPlannedRemainingMinutes() + " mins."); } else { // Set a fake neutral temp to avoid TBR cancel alert. Decide 90% vs 110% based on // on whether the TBR we're cancelling is above or below 100%. @@ -898,11 +898,9 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { pump.lastSuccessfulCmdTime = System.currentTimeMillis(); if (validBasalRateProfileSelectedOnPump && commandResult.state.unsafeUsageDetected == PumpState.UNSUPPORTED_BASAL_RATE_PROFILE) { setValidBasalRateProfileSelectedOnPump(false); - Notification n = new Notification(Notification.COMBO_PUMP_ALARM, + activityNames.addNotificationWithSound(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_force_disabled_notification), - Notification.URGENT); - n.setSoundId(R.raw.alarm); - rxBus.send(new EventNewNotification(n)); + Notification.URGENT, R.raw.alarm); commandQueue.cancelTempBasal(true, null); } updateLocalData(commandResult); @@ -949,8 +947,8 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { // so update the var with it, so the check routines below can work on it preCheckResult = alertConfirmationResult; } else if (activeAlert.errorCode != null) { - Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, dateUtil.now(), getRh().gs(R.string.combo_is_in_error_state, activeAlert.errorCode, activeAlert.message), Notification.URGENT, 0); - rxBus.send(new EventNewNotification(notification)); + activityNames.addNotificationValidTo(Notification.COMBO_PUMP_ALARM, dateUtil.now(), + getRh().gs(R.string.combo_is_in_error_state, activeAlert.errorCode, activeAlert.message), Notification.URGENT, 0); return preCheckResult.success(false); } } @@ -1013,11 +1011,11 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { CommandResult readBasalResult = runCommand(getRh().gs(R.string.combo_actvity_reading_basal_profile), 2, ruffyScripter::readBasalProfile); if (readBasalResult.success) { pump.basalProfile = readBasalResult.basalProfile; - Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_warning_pump_basal_rate_changed), Notification.NORMAL); - rxBus.send(new EventNewNotification(notification)); + activityNames.addNotification(Notification.COMBO_PUMP_ALARM, + getRh().gs(R.string.combo_warning_pump_basal_rate_changed), Notification.NORMAL); } else { - Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_error_failure_reading_changed_basal_rate), Notification.URGENT); - rxBus.send(new EventNewNotification(notification)); + activityNames.addNotification(Notification.COMBO_PUMP_ALARM, + getRh().gs(R.string.combo_error_failure_reading_changed_basal_rate), Notification.URGENT); } } } @@ -1031,12 +1029,10 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { // time couldn't be read (e.g. a warning is displayed on the menu , hiding the time field) } else if (Math.abs(state.pumpTime - System.currentTimeMillis()) >= 10 * 60 * 1000) { getAapsLogger().debug(LTag.PUMP, "Pump clock needs update, pump time: " + state.pumpTime + " (" + new Date(state.pumpTime) + ")"); - Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_notification_check_time_date), Notification.URGENT); - rxBus.send(new EventNewNotification(notification)); + activityNames.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_notification_check_time_date), Notification.URGENT); } else if (Math.abs(state.pumpTime - System.currentTimeMillis()) >= 3 * 60 * 1000) { getAapsLogger().debug(LTag.PUMP, "Pump clock needs update, pump time: " + state.pumpTime + " (" + new Date(state.pumpTime) + ")"); - Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_notification_check_time_date), Notification.NORMAL); - rxBus.send(new EventNewNotification(notification)); + activityNames.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_notification_check_time_date), Notification.NORMAL); } } @@ -1047,18 +1043,15 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { && !activeAlert.warningCode.equals(PumpWarningCodes.TBR_CANCELLED))) { throw new IllegalArgumentException(activeAlert.toString()); } - Notification notification = new Notification(); - notification.setDate(dateUtil.now()); - notification.setId(Notification.COMBO_PUMP_ALARM); - notification.setLevel(Notification.NORMAL); + String text = ""; if (activeAlert.warningCode == PumpWarningCodes.CARTRIDGE_LOW) { - notification.setText(getRh().gs(R.string.combo_pump_cartridge_low_warrning)); + text = getRh().gs(R.string.combo_pump_cartridge_low_warrning); } else if (activeAlert.warningCode == PumpWarningCodes.BATTERY_LOW) { - notification.setText(getRh().gs(R.string.combo_pump_battery_low_warrning)); + text = getRh().gs(R.string.combo_pump_battery_low_warrning); } else if (activeAlert.warningCode == PumpWarningCodes.TBR_CANCELLED) { - notification.setText(getRh().gs(R.string.combo_pump_tbr_cancelled_warrning)); + text = getRh().gs(R.string.combo_pump_tbr_cancelled_warrning); } - rxBus.send(new EventNewNotification(notification)); + activityNames.addNotification(Notification.COMBO_PUMP_ALARM, text, Notification.NORMAL); } private void checkForUnsafeUsage(CommandResult commandResult) { @@ -1077,11 +1070,9 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { if (lastViolation > 0) { lowSuspendOnlyLoopEnforcedUntil = lastViolation + 6 * 60 * 60 * 1000; if (lowSuspendOnlyLoopEnforcedUntil > System.currentTimeMillis() && violationWarningRaisedForBolusAt != lowSuspendOnlyLoopEnforcedUntil) { - Notification n = new Notification(Notification.COMBO_PUMP_ALARM, + activityNames.addNotificationWithSound(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string.combo_low_suspend_forced_notification), - Notification.URGENT); - n.setSoundId(R.raw.alarm); - rxBus.send(new EventNewNotification(n)); + Notification.URGENT, R.raw.alarm); violationWarningRaisedForBolusAt = lowSuspendOnlyLoopEnforcedUntil; commandQueue.cancelTempBasal(true, null); } @@ -1109,7 +1100,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { PumpType.ACCU_CHEK_COMBO, serialNumber() ); - } else if (aapsTbr != null && PumpStateExtensionKt.getPlannedRemainingMinutes(aapsTbr) > 2 && !state.tbrActive) { + } else if (aapsTbr != null && aapsTbr.getPlannedRemainingMinutes() > 2 && !state.tbrActive) { getAapsLogger().debug(LTag.PUMP, "Ending AAPS-TBR since pump has no TBR active"); pumpSync.syncStopTemporaryBasalWithPumpId( now, @@ -1119,7 +1110,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { ); } else if (aapsTbr != null && state.tbrActive && (aapsTbr.getRate() != state.tbrPercent || - Math.abs(PumpStateExtensionKt.getPlannedRemainingMinutes(aapsTbr) - state.tbrRemainingDuration) > 2)) { + Math.abs(aapsTbr.getPlannedRemainingMinutes() - state.tbrRemainingDuration) > 2)) { getAapsLogger().debug(LTag.PUMP, "AAPSs and pump-TBR differ; ending AAPS-TBR and creating new TBR based on pump TBR"); // crate TBR end record a second ago @@ -1249,9 +1240,8 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { HashSet bolusSet = new HashSet<>(historyResult.history.bolusHistory); if (bolusSet.size() != historyResult.history.bolusHistory.size()) { getAapsLogger().debug(LTag.PUMP, "Bolus with same amount within the same minute imported. Only one will make it to the DB."); - Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string. + activityNames.addNotification(Notification.COMBO_PUMP_ALARM, getRh().gs(R.string. combo_error_multiple_boluses_with_identical_timestamp), Notification.URGENT); - rxBus.send(new EventNewNotification(notification)); } pumpHistoryChanged = updateDbFromPumpHistory(historyResult.history); @@ -1405,14 +1395,14 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { @NonNull @Override public Constraint isLoopInvocationAllowed(@NonNull Constraint value) { if (!validBasalRateProfileSelectedOnPump) - value.set(getAapsLogger(), false, getRh().gs(R.string.novalidbasalrate), this); + value.set(getAapsLogger(), false, getRh().gs(R.string.no_valid_basal_rate), this); return value; } @NonNull @Override public Constraint applyMaxIOBConstraints(@NonNull Constraint maxIob) { if (lowSuspendOnlyLoopEnforcedUntil > System.currentTimeMillis()) - maxIob.setIfSmaller(getAapsLogger(), 0d, getRh().gs(R.string.limitingmaxiob, 0d, getRh().gs(R.string.unsafeusage)), this); + maxIob.setIfSmaller(getAapsLogger(), 0d, getRh().gs(R.string.limiting_iob, 0d, getRh().gs(R.string.unsafeusage)), this); return maxIob; } diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPump.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ComboPump.java similarity index 59% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPump.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ComboPump.java index c5d7fa0115..1f72ff43b6 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPump.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ComboPump.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo; +package info.nightscout.pump.combo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -6,11 +6,11 @@ import androidx.annotation.Nullable; import java.util.ArrayList; import java.util.List; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BasalProfile; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpState; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Bolus; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpAlert; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Tdd; +import info.nightscout.pump.combo.ruffyscripter.BasalProfile; +import info.nightscout.pump.combo.ruffyscripter.PumpState; +import info.nightscout.pump.combo.ruffyscripter.history.Bolus; +import info.nightscout.pump.combo.ruffyscripter.history.PumpAlert; +import info.nightscout.pump.combo.ruffyscripter.history.Tdd; class ComboPump { boolean initialized = false; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/data/ComboErrorUtil.kt b/pump/combo/src/main/java/info/nightscout/pump/combo/data/ComboErrorUtil.kt similarity index 94% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/data/ComboErrorUtil.kt rename to pump/combo/src/main/java/info/nightscout/pump/combo/data/ComboErrorUtil.kt index c5d33645bb..abc640f3ac 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/data/ComboErrorUtil.kt +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/data/ComboErrorUtil.kt @@ -1,6 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.combo.data +package info.nightscout.pump.combo.data -import info.nightscout.androidaps.combo.R +import info.nightscout.pump.combo.R import info.nightscout.shared.sharedPreferences.SP import javax.inject.Inject import javax.inject.Singleton diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/combo/di/ComboActivitiesModule.kt b/pump/combo/src/main/java/info/nightscout/pump/combo/di/ComboActivitiesModule.kt similarity index 80% rename from pump/combo/src/main/java/info/nightscout/androidaps/combo/di/ComboActivitiesModule.kt rename to pump/combo/src/main/java/info/nightscout/pump/combo/di/ComboActivitiesModule.kt index 7e0541a183..ea71e7d0b1 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/combo/di/ComboActivitiesModule.kt +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/di/ComboActivitiesModule.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.danars.di import dagger.Module import dagger.android.ContributesAndroidInjector -import info.nightscout.androidaps.plugins.pump.combo.ComboFragment +import info.nightscout.pump.combo.ComboFragment @Module @Suppress("unused") diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/combo/di/ComboModule.kt b/pump/combo/src/main/java/info/nightscout/pump/combo/di/ComboModule.kt similarity index 79% rename from pump/combo/src/main/java/info/nightscout/androidaps/combo/di/ComboModule.kt rename to pump/combo/src/main/java/info/nightscout/pump/combo/di/ComboModule.kt index b2d117bbc1..d31494715d 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/combo/di/ComboModule.kt +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/di/ComboModule.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.combo.di +package info.nightscout.pump.combo.di import dagger.Module import info.nightscout.androidaps.danars.di.ComboActivitiesModule diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/events/EventComboPumpUpdateGUI.kt b/pump/combo/src/main/java/info/nightscout/pump/combo/events/EventComboPumpUpdateGUI.kt similarity index 61% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/events/EventComboPumpUpdateGUI.kt rename to pump/combo/src/main/java/info/nightscout/pump/combo/events/EventComboPumpUpdateGUI.kt index f1132704b1..b349d40979 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/events/EventComboPumpUpdateGUI.kt +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/events/EventComboPumpUpdateGUI.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.events +package info.nightscout.pump.combo.events import info.nightscout.rx.events.EventUpdateGui diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BasalProfile.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/BasalProfile.java similarity index 93% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BasalProfile.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/BasalProfile.java index 721bc26cbc..bbe9e6bfb2 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BasalProfile.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/BasalProfile.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; +package info.nightscout.pump.combo.ruffyscripter; import androidx.annotation.NonNull; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BolusProgressReporter.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/BolusProgressReporter.java similarity index 77% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BolusProgressReporter.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/BolusProgressReporter.java index 6fb7c54201..7ce086af96 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BolusProgressReporter.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/BolusProgressReporter.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; +package info.nightscout.pump.combo.ruffyscripter; public interface BolusProgressReporter { enum State { diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/CommandResult.java similarity index 91% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/CommandResult.java index 67a17b6563..3831835988 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/CommandResult.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; +package info.nightscout.pump.combo.ruffyscripter; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -6,7 +6,7 @@ import androidx.annotation.Nullable; import java.util.LinkedList; import java.util.List; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpHistory; +import info.nightscout.pump.combo.ruffyscripter.history.PumpHistory; public class CommandResult { /** True if a condition indicating a broken pump setup/configuration is detected */ diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpErrorCodes.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/PumpErrorCodes.java similarity index 90% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpErrorCodes.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/PumpErrorCodes.java index d557c067c1..d9dfea6ea5 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpErrorCodes.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/PumpErrorCodes.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; +package info.nightscout.pump.combo.ruffyscripter; public class PumpErrorCodes { public static final int CARTRIDGE_EMPTY = 1; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpState.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/PumpState.java similarity index 98% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpState.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/PumpState.java index 117ea88eb9..5186a66246 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpState.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/PumpState.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; +package info.nightscout.pump.combo.ruffyscripter; /** State displayed on the main screen of the pump. */ public class PumpState { diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpWarningCodes.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/PumpWarningCodes.java similarity index 87% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpWarningCodes.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/PumpWarningCodes.java index b3f87e6b92..11ecfff19a 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/PumpWarningCodes.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/PumpWarningCodes.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; +package info.nightscout.pump.combo.ruffyscripter; public class PumpWarningCodes { public static final int CARTRIDGE_LOW = 1; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyCommands.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/RuffyCommands.java similarity index 90% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyCommands.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/RuffyCommands.java index 1b9b5414ec..05da6d0855 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyCommands.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/RuffyCommands.java @@ -1,7 +1,8 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; +package info.nightscout.pump.combo.ruffyscripter; import androidx.annotation.Nullable; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpHistoryRequest; + +import info.nightscout.pump.combo.ruffyscripter.history.PumpHistoryRequest; public interface RuffyCommands { /** Issues a bolus issues updates on progress through via {@link BolusProgressReporter}. */ diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/RuffyScripter.java similarity index 96% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/RuffyScripter.java index 18b6e9cc3d..a12bb82fd0 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/RuffyScripter.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; +package info.nightscout.pump.combo.ruffyscripter; import android.content.ComponentName; import android.content.Context; @@ -28,19 +28,19 @@ import java.util.Objects; import javax.inject.Inject; import javax.inject.Singleton; -import info.nightscout.androidaps.plugins.pump.combo.data.ComboErrorUtil; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands.BolusCommand; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands.CancelTbrCommand; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands.Command; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands.CommandException; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands.ConfirmAlertCommand; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands.ReadBasalProfileCommand; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands.ReadHistoryCommand; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands.ReadPumpStateCommand; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands.ReadQuickInfoCommand; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands.SetBasalProfileCommand; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands.SetTbrCommand; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpHistoryRequest; +import info.nightscout.pump.combo.data.ComboErrorUtil; +import info.nightscout.pump.combo.ruffyscripter.commands.BolusCommand; +import info.nightscout.pump.combo.ruffyscripter.commands.CancelTbrCommand; +import info.nightscout.pump.combo.ruffyscripter.commands.Command; +import info.nightscout.pump.combo.ruffyscripter.commands.CommandException; +import info.nightscout.pump.combo.ruffyscripter.commands.ConfirmAlertCommand; +import info.nightscout.pump.combo.ruffyscripter.commands.ReadBasalProfileCommand; +import info.nightscout.pump.combo.ruffyscripter.commands.ReadHistoryCommand; +import info.nightscout.pump.combo.ruffyscripter.commands.ReadPumpStateCommand; +import info.nightscout.pump.combo.ruffyscripter.commands.ReadQuickInfoCommand; +import info.nightscout.pump.combo.ruffyscripter.commands.SetBasalProfileCommand; +import info.nightscout.pump.combo.ruffyscripter.commands.SetTbrCommand; +import info.nightscout.pump.combo.ruffyscripter.history.PumpHistoryRequest; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/WarningOrErrorCode.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/WarningOrErrorCode.java similarity index 90% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/WarningOrErrorCode.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/WarningOrErrorCode.java index 7692afe84e..50205f441e 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/WarningOrErrorCode.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/WarningOrErrorCode.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; +package info.nightscout.pump.combo.ruffyscripter; import androidx.annotation.Nullable; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BaseCommand.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/BaseCommand.java similarity index 85% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BaseCommand.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/BaseCommand.java index 1de9392cba..6bf530e583 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BaseCommand.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/BaseCommand.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; +package info.nightscout.pump.combo.ruffyscripter.commands; import androidx.annotation.NonNull; @@ -12,10 +12,10 @@ import java.util.Calendar; import java.util.Collections; import java.util.List; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.CommandResult; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpWarningCodes; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.RuffyScripter; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Bolus; +import info.nightscout.pump.combo.ruffyscripter.CommandResult; +import info.nightscout.pump.combo.ruffyscripter.PumpWarningCodes; +import info.nightscout.pump.combo.ruffyscripter.RuffyScripter; +import info.nightscout.pump.combo.ruffyscripter.history.Bolus; public abstract class BaseCommand implements Command { // RS will inject itself here diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BolusCommand.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/BolusCommand.java similarity index 86% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BolusCommand.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/BolusCommand.java index 6d97d62228..ade941e2c8 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BolusCommand.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/BolusCommand.java @@ -1,10 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; - -import static info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BolusProgressReporter.State.DELIVERED; -import static info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BolusProgressReporter.State.DELIVERING; -import static info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BolusProgressReporter.State.PROGRAMMING; -import static info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BolusProgressReporter.State.STOPPED; -import static info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BolusProgressReporter.State.STOPPING; +package info.nightscout.pump.combo.ruffyscripter.commands; import android.os.SystemClock; @@ -17,10 +11,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BolusProgressReporter; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpWarningCodes; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.RuffyScripter; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.WarningOrErrorCode; +import info.nightscout.pump.combo.ruffyscripter.BolusProgressReporter; +import info.nightscout.pump.combo.ruffyscripter.PumpWarningCodes; +import info.nightscout.pump.combo.ruffyscripter.RuffyScripter; +import info.nightscout.pump.combo.ruffyscripter.WarningOrErrorCode; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; @@ -57,22 +51,22 @@ public class BolusCommand extends BaseCommand { @Override public void execute() { if (cancelRequested) { - bolusProgressReporter.report(STOPPED, 0, 0); + bolusProgressReporter.report(BolusProgressReporter.State.STOPPED, 0, 0); result.success = true; aapsLogger.debug(LTag.PUMP, "Stage 0: cancelled bolus before programming"); return; } - bolusProgressReporter.report(PROGRAMMING, 0, 0); + bolusProgressReporter.report(BolusProgressReporter.State.PROGRAMMING, 0, 0); enterBolusMenu(); inputBolusAmount(); verifyDisplayedBolusAmount(); // last chance to abort before confirming the bolus if (cancelRequested) { - bolusProgressReporter.report(STOPPING, 0, 0); + bolusProgressReporter.report(BolusProgressReporter.State.STOPPING, 0, 0); scripter.returnToRootMenu(); - bolusProgressReporter.report(STOPPED, 0, 0); + bolusProgressReporter.report(BolusProgressReporter.State.STOPPED, 0, 0); result.success = true; aapsLogger.debug(LTag.PUMP, "Stage 1: cancelled bolus after programming"); return; @@ -87,14 +81,14 @@ public class BolusCommand extends BaseCommand { while (scripter.getCurrentMenu().getType() == MenuType.BOLUS_ENTER) { if (cancelRequested) { aapsLogger.debug(LTag.PUMP, "Stage 2: cancelling during confirmation wait"); - bolusProgressReporter.report(STOPPING, 0, 0); + bolusProgressReporter.report(BolusProgressReporter.State.STOPPING, 0, 0); scripter.pressUpKey(); // wait up to 1s for a BOLUS_CANCELLED alert, if it doesn't happen we missed // the window, simply continue and let the next cancel attempt try its luck boolean alertWasCancelled = scripter.confirmAlert(PumpWarningCodes.BOLUS_CANCELLED, 1000); if (alertWasCancelled) { aapsLogger.debug(LTag.PUMP, "Stage 2: successfully cancelled during confirmation wait"); - bolusProgressReporter.report(STOPPED, 0, 0); + bolusProgressReporter.report(BolusProgressReporter.State.STOPPED, 0, 0); result.success = true; return; } @@ -106,7 +100,7 @@ public class BolusCommand extends BaseCommand { scripter.verifyMenuIsDisplayed(MenuType.MAIN_MENU, "Pump did not return to MAIN_MEU from BOLUS_ENTER to deliver bolus. " + "Check pump manually, the bolus might not have been delivered."); - bolusProgressReporter.report(DELIVERING, 0, 0); + bolusProgressReporter.report(BolusProgressReporter.State.DELIVERING, 0, 0); // wait for bolus delivery to complete; the remaining units to deliver are counted down boolean cancelInProgress = false; @@ -116,7 +110,7 @@ public class BolusCommand extends BaseCommand { while (bolusRemaining != null || scripter.getCurrentMenu().getType() == MenuType.WARNING_OR_ERROR) { if (cancelRequested && !cancelInProgress) { aapsLogger.debug(LTag.PUMP, "Stage 3: cancellation while delivering bolus"); - bolusProgressReporter.report(STOPPING, 0, 0); + bolusProgressReporter.report(BolusProgressReporter.State.STOPPING, 0, 0); cancelInProgress = true; cancellationThread = new Thread(() -> scripter.pressKeyMs(RuffyScripter.Key.UP, 3000), "bolus-canceller"); @@ -140,7 +134,7 @@ public class BolusCommand extends BaseCommand { } } scripter.confirmAlert(PumpWarningCodes.BOLUS_CANCELLED, 2000); - bolusProgressReporter.report(STOPPED, 0, 0); + bolusProgressReporter.report(BolusProgressReporter.State.STOPPED, 0, 0); aapsLogger.debug(LTag.PUMP, "Stage 3: confirmed BOLUS CANCELLED after cancelling bolus during delivery"); } else if (Objects.equals(warningCode, PumpWarningCodes.CARTRIDGE_LOW)) { scripter.confirmAlert(PumpWarningCodes.CARTRIDGE_LOW, 2000); @@ -169,7 +163,7 @@ public class BolusCommand extends BaseCommand { if (bolusRemaining != null && !Objects.equals(bolusRemaining, lastBolusReported)) { aapsLogger.debug(LTag.PUMP, "Delivering bolus, remaining: " + bolusRemaining); int percentDelivered = (int) (100 - (bolusRemaining / bolus * 100)); - bolusProgressReporter.report(DELIVERING, percentDelivered, bolus - bolusRemaining); + bolusProgressReporter.report(BolusProgressReporter.State.DELIVERING, percentDelivered, bolus - bolusRemaining); lastBolusReported = bolusRemaining; } SystemClock.sleep(50); @@ -190,7 +184,7 @@ public class BolusCommand extends BaseCommand { aapsLogger.debug(LTag.PUMP, "Stage 4: bolus was cancelled, with unknown amount delivered"); } else { aapsLogger.debug(LTag.PUMP, "Stage 4: full bolus of " + bolus + " U was successfully delivered"); - bolusProgressReporter.report(DELIVERED, 100, bolus); + bolusProgressReporter.report(BolusProgressReporter.State.DELIVERED, 100, bolus); } result.success = true; } @@ -244,7 +238,7 @@ public class BolusCommand extends BaseCommand { public void requestCancellation() { aapsLogger.debug(LTag.PUMP, "Bolus cancellation requested"); cancelRequested = true; - bolusProgressReporter.report(STOPPING, 0, 0); + bolusProgressReporter.report(BolusProgressReporter.State.STOPPING, 0, 0); } @Override @NonNull diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CancelTbrCommand.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/CancelTbrCommand.java similarity index 85% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CancelTbrCommand.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/CancelTbrCommand.java index 9faa7a135a..2a5627fa28 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CancelTbrCommand.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/CancelTbrCommand.java @@ -1,11 +1,11 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; +package info.nightscout.pump.combo.ruffyscripter.commands; import androidx.annotation.NonNull; import org.monkey.d.ruffy.ruffy.driver.display.MenuType; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpState; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpWarningCodes; +import info.nightscout.pump.combo.ruffyscripter.PumpState; +import info.nightscout.pump.combo.ruffyscripter.PumpWarningCodes; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/Command.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/Command.java similarity index 69% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/Command.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/Command.java index cd6c30439a..3e1ee17ddd 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/Command.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/Command.java @@ -1,9 +1,9 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; +package info.nightscout.pump.combo.ruffyscripter.commands; import java.util.List; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.RuffyScripter; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.CommandResult; +import info.nightscout.pump.combo.ruffyscripter.CommandResult; +import info.nightscout.pump.combo.ruffyscripter.RuffyScripter; /** * Interface for all commands to be executed by the pump. diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CommandException.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/CommandException.java similarity index 75% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CommandException.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/CommandException.java index e92e5e32cf..d6e43e5f1f 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CommandException.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/CommandException.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; +package info.nightscout.pump.combo.ruffyscripter.commands; public class CommandException extends RuntimeException { public CommandException(String message) { diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ConfirmAlertCommand.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ConfirmAlertCommand.java similarity index 87% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ConfirmAlertCommand.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ConfirmAlertCommand.java index 0b1fcc3821..b7060ee3cb 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ConfirmAlertCommand.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ConfirmAlertCommand.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; +package info.nightscout.pump.combo.ruffyscripter.commands; public class ConfirmAlertCommand extends BaseCommand { private final int warningCode; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadBasalProfileCommand.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ReadBasalProfileCommand.java similarity index 91% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadBasalProfileCommand.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ReadBasalProfileCommand.java index 7d8a721d00..3c72fe0991 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadBasalProfileCommand.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ReadBasalProfileCommand.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; +package info.nightscout.pump.combo.ruffyscripter.commands; import androidx.annotation.NonNull; @@ -9,8 +9,8 @@ import org.monkey.d.ruffy.ruffy.driver.display.menu.MenuTime; import java.util.Arrays; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BasalProfile; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpState; +import info.nightscout.pump.combo.ruffyscripter.BasalProfile; +import info.nightscout.pump.combo.ruffyscripter.PumpState; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java similarity index 95% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java index 61dbdf292f..4653371076 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; +package info.nightscout.pump.combo.ruffyscripter.commands; import androidx.annotation.NonNull; @@ -10,12 +10,12 @@ import org.monkey.d.ruffy.ruffy.driver.display.menu.MenuTime; import java.util.Calendar; import java.util.Date; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Bolus; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpAlert; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpHistory; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpHistoryRequest; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Tbr; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Tdd; +import info.nightscout.pump.combo.ruffyscripter.history.Bolus; +import info.nightscout.pump.combo.ruffyscripter.history.PumpAlert; +import info.nightscout.pump.combo.ruffyscripter.history.PumpHistory; +import info.nightscout.pump.combo.ruffyscripter.history.PumpHistoryRequest; +import info.nightscout.pump.combo.ruffyscripter.history.Tbr; +import info.nightscout.pump.combo.ruffyscripter.history.Tdd; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadPumpStateCommand.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ReadPumpStateCommand.java similarity index 82% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadPumpStateCommand.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ReadPumpStateCommand.java index 19beb26fe6..7076f242d7 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadPumpStateCommand.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ReadPumpStateCommand.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; +package info.nightscout.pump.combo.ruffyscripter.commands; public class ReadPumpStateCommand extends BaseCommand { @Override diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadQuickInfoCommand.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ReadQuickInfoCommand.java similarity index 92% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadQuickInfoCommand.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ReadQuickInfoCommand.java index 870f64e28e..ad16eef5db 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadQuickInfoCommand.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/ReadQuickInfoCommand.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; +package info.nightscout.pump.combo.ruffyscripter.commands; import androidx.annotation.NonNull; @@ -9,8 +9,8 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Bolus; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpHistory; +import info.nightscout.pump.combo.ruffyscripter.history.Bolus; +import info.nightscout.pump.combo.ruffyscripter.history.PumpHistory; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetBasalProfileCommand.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/SetBasalProfileCommand.java similarity index 96% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetBasalProfileCommand.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/SetBasalProfileCommand.java index 53954cba9f..bf65ff4215 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetBasalProfileCommand.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/SetBasalProfileCommand.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; +package info.nightscout.pump.combo.ruffyscripter.commands; import android.os.SystemClock; @@ -12,8 +12,8 @@ import org.monkey.d.ruffy.ruffy.driver.display.menu.MenuTime; import java.util.ArrayList; import java.util.List; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BasalProfile; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpState; +import info.nightscout.pump.combo.ruffyscripter.BasalProfile; +import info.nightscout.pump.combo.ruffyscripter.PumpState; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetTbrCommand.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/SetTbrCommand.java similarity index 97% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetTbrCommand.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/SetTbrCommand.java index 820fa56b48..ab585848de 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/SetTbrCommand.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/commands/SetTbrCommand.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; +package info.nightscout.pump.combo.ruffyscripter.commands; import android.os.SystemClock; @@ -12,9 +12,9 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpState; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpWarningCodes; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.WarningOrErrorCode; +import info.nightscout.pump.combo.ruffyscripter.PumpState; +import info.nightscout.pump.combo.ruffyscripter.PumpWarningCodes; +import info.nightscout.pump.combo.ruffyscripter.WarningOrErrorCode; import info.nightscout.rx.logging.AAPSLogger; import info.nightscout.rx.logging.LTag; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Bolus.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/Bolus.java similarity index 93% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Bolus.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/Bolus.java index cf1450feb2..09217ce237 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Bolus.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/Bolus.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history; +package info.nightscout.pump.combo.ruffyscripter.history; import java.util.Date; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/HistoryRecord.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/HistoryRecord.java similarity index 67% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/HistoryRecord.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/HistoryRecord.java index 3857a8b877..e664c8cb80 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/HistoryRecord.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/HistoryRecord.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history; +package info.nightscout.pump.combo.ruffyscripter.history; public abstract class HistoryRecord { public final long timestamp; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpAlert.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/PumpAlert.java similarity index 95% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpAlert.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/PumpAlert.java index 0797d77151..e759739f0a 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpAlert.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/PumpAlert.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history; +package info.nightscout.pump.combo.ruffyscripter.history; import java.util.Date; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistory.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/PumpHistory.java similarity index 94% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistory.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/PumpHistory.java index b9e9c704a0..1c5e60a540 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistory.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/PumpHistory.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history; +package info.nightscout.pump.combo.ruffyscripter.history; import androidx.annotation.NonNull; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistoryRequest.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/PumpHistoryRequest.java similarity index 96% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistoryRequest.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/PumpHistoryRequest.java index a121ea9425..3bc7e39c7c 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/PumpHistoryRequest.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/PumpHistoryRequest.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history; +package info.nightscout.pump.combo.ruffyscripter.history; import java.util.Date; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tbr.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/Tbr.java similarity index 93% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tbr.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/Tbr.java index 401fc026b7..03fee114d4 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tbr.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/Tbr.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history; +package info.nightscout.pump.combo.ruffyscripter.history; import java.util.Date; diff --git a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tdd.java b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/Tdd.java similarity index 93% rename from pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tdd.java rename to pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/Tdd.java index c469cc9606..1e3b3570f7 100644 --- a/pump/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/history/Tdd.java +++ b/pump/combo/src/main/java/info/nightscout/pump/combo/ruffyscripter/history/Tdd.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history; +package info.nightscout.pump.combo.ruffyscripter.history; import androidx.annotation.NonNull; diff --git a/pump/combo/src/main/res/layout/combopump_fragment.xml b/pump/combo/src/main/res/layout/combopump_fragment.xml index b43eabf556..607d332db3 100644 --- a/pump/combo/src/main/res/layout/combopump_fragment.xml +++ b/pump/combo/src/main/res/layout/combopump_fragment.xml @@ -3,7 +3,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="5dp" - tools:context="info.nightscout.androidaps.plugins.pump.combo.ComboFragment"> + tools:context=".ComboFragment"> @@ -269,7 +269,7 @@ android:layout_weight="1.5" android:paddingStart="0dp" android:paddingEnd="5dp" - android:text="@string/lastbolus_label" + android:text="@string/last_bolus_label" android:textAlignment="viewEnd" android:textSize="14sp" /> @@ -558,7 +558,7 @@ android:layout_weight="1.5" android:paddingStart="0dp" android:paddingEnd="5dp" - android:text="@string/serialnumber" + android:text="@string/serial_number" android:textAlignment="viewEnd" android:textSize="14sp" /> diff --git a/pump/combo/src/main/res/values/strings.xml b/pump/combo/src/main/res/values/strings.xml index 314a3e468c..2b5f21bd52 100644 --- a/pump/combo/src/main/res/values/strings.xml +++ b/pump/combo/src/main/res/values/strings.xml @@ -72,4 +72,6 @@ ON_ERROR ALWAYS + unsafe usage + diff --git a/pump/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt b/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt similarity index 88% rename from pump/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt rename to pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt index dcba982f18..8783621810 100644 --- a/pump/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt +++ b/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt @@ -1,18 +1,18 @@ -package info.nightscout.androidaps.plugins.pump.combo +package info.nightscout.pump.combo import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase -import info.nightscout.androidaps.combo.R -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.RuffyScripter -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.Bolus import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.pump.PumpEnactResult import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.queue.CommandQueue +import info.nightscout.interfaces.ui.ActivityNames +import info.nightscout.pump.combo.ruffyscripter.RuffyScripter +import info.nightscout.pump.combo.ruffyscripter.history.Bolus import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP @@ -33,6 +33,7 @@ class ComboPluginTest : TestBase() { @Mock lateinit var dateUtil: DateUtil @Mock lateinit var ruffyScripter: RuffyScripter @Mock lateinit var context: Context + @Mock lateinit var activityNames: ActivityNames private val injector = HasAndroidInjector { AndroidInjector { @@ -46,9 +47,9 @@ class ComboPluginTest : TestBase() { @Before fun prepareMocks() { - `when`(rh.gs(R.string.novalidbasalrate)).thenReturn("No valid basal rate read from pump") + `when`(rh.gs(R.string.no_valid_basal_rate)).thenReturn("No valid basal rate read from pump") `when`(context.getString(R.string.combo_pump_unsupported_operation)).thenReturn("Requested operation not supported by pump") - comboPlugin = ComboPlugin(injector, aapsLogger, RxBus(aapsSchedulers, aapsLogger), rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter) + comboPlugin = ComboPlugin(injector, aapsLogger, RxBus(aapsSchedulers, aapsLogger), rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter, activityNames) } @Test diff --git a/pump/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/TestBase.kt b/pump/combo/src/test/java/info/nightscout/pump/combo/TestBase.kt similarity index 100% rename from pump/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/TestBase.kt rename to pump/combo/src/test/java/info/nightscout/pump/combo/TestBase.kt diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Fragment.kt b/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Fragment.kt index 442f7a9845..b9afec68ab 100644 --- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Fragment.kt +++ b/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Fragment.kt @@ -13,8 +13,6 @@ import dagger.android.support.DaggerFragment import info.nightscout.androidaps.combov2.R import info.nightscout.androidaps.combov2.databinding.Combov2FragmentBinding import info.nightscout.comboctl.base.NullDisplayFrame -import info.nightscout.comboctl.main.Pump as ComboCtlPump -import info.nightscout.comboctl.base.Tbr as ComboCtlTbr import info.nightscout.comboctl.parser.BatteryState import info.nightscout.comboctl.parser.ReservoirState import info.nightscout.interfaces.queue.CommandQueue @@ -23,9 +21,11 @@ import kotlinx.coroutines.delay import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch -import kotlin.math.max import java.util.Locale import javax.inject.Inject +import kotlin.math.max +import info.nightscout.comboctl.base.Tbr as ComboCtlTbr +import info.nightscout.comboctl.main.Pump as ComboCtlPump class ComboV2Fragment : DaggerFragment() { @Inject lateinit var combov2Plugin: ComboV2Plugin @@ -181,7 +181,7 @@ class ComboV2Fragment : DaggerFragment() { combov2Plugin.baseBasalRateUIFlow .onEach { baseBasalRate -> binding.combov2BaseBasalRate.text = if (baseBasalRate != null) - rh.gs(R.string.pump_basebasalrate, baseBasalRate) + rh.gs(R.string.pump_base_basal_rate, baseBasalRate) else "" } diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Plugin.kt b/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Plugin.kt index 1da9d69f72..2ddb5d0109 100644 --- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Plugin.kt +++ b/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Plugin.kt @@ -26,7 +26,6 @@ import info.nightscout.comboctl.parser.BatteryState import info.nightscout.comboctl.parser.ReservoirState import info.nightscout.core.events.EventNewNotification import info.nightscout.core.pump.convertedToAbsolute -import info.nightscout.core.pump.plannedRemainingMinutes import info.nightscout.core.pump.toStringFull import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.toast.ToastUtils @@ -638,7 +637,7 @@ class ComboV2Plugin @Inject constructor ( val notification = Notification( Notification.PROFILE_NOT_SET_NOT_INITIALIZED, - rh.gs(R.string.pumpNotInitializedProfileNotSet), + rh.gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT ) rxBus.send(EventNewNotification(notification)) @@ -646,7 +645,7 @@ class ComboV2Plugin @Inject constructor ( return PumpEnactResult(injector).apply { success = false enacted = false - comment = rh.gs(R.string.pumpNotInitializedProfileNotSet) + comment = rh.gs(R.string.pump_not_initialized_profile_not_set) } } @@ -699,7 +698,7 @@ class ComboV2Plugin @Inject constructor ( val notification = Notification( Notification.FAILED_UPDATE_PROFILE, - rh.gs(R.string.failedupdatebasalprofile), + rh.gs(R.string.failed_update_basal_profile), Notification.URGENT ) rxBus.send(EventNewNotification(notification)) @@ -707,7 +706,7 @@ class ComboV2Plugin @Inject constructor ( pumpEnactResult.apply { success = false enacted = false - comment = rh.gs(R.string.failedupdatebasalprofile) + comment = rh.gs(R.string.failed_update_basal_profile) } } } @@ -865,7 +864,7 @@ class ComboV2Plugin @Inject constructor ( acquiredPump.deliverBolus(requestedBolusAmount, bolusReason) } - reportFinishedBolus(rh.gs(R.string.bolusdelivered, detailedBolusInfo.insulin), pumpEnactResult, succeeded = true) + reportFinishedBolus(rh.gs(R.string.bolus_delivered, detailedBolusInfo.insulin), pumpEnactResult, succeeded = true) // TODO: Check that an alert sound and error dialog // are produced if an exception was thrown that diff --git a/pump/combov2/src/main/res/layout/combov2_fragment.xml b/pump/combov2/src/main/res/layout/combov2_fragment.xml index c158844334..6cfb0f3913 100644 --- a/pump/combov2/src/main/res/layout/combov2_fragment.xml +++ b/pump/combov2/src/main/res/layout/combov2_fragment.xml @@ -99,7 +99,7 @@ android:layout_weight="1.5" android:gravity="end" android:paddingRight="5dp" - android:text="@string/lastconnection_label" + android:text="@string/last_connection_label" android:textSize="14sp" /> @@ -176,7 +176,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:paddingEnd="5dp" - android:text="@string/lastconnection_label" + android:text="@string/last_connection_label" android:textAlignment="viewEnd" android:textSize="14sp" tools:ignore="RtlSymmetry" /> @@ -224,7 +224,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:paddingEnd="5dp" - android:text="@string/lastbolus_label" + android:text="@string/last_bolus_label" android:textAlignment="viewEnd" android:textSize="14sp" tools:ignore="RtlSymmetry" /> diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java index 524957dbb6..0d6eb00770 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java @@ -144,17 +144,17 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump } if (!isInitialized()) { getAapsLogger().error("setNewBasalProfile not initialized"); - Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, getRh().gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT); + Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, getRh().gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT); rxBus.send(new EventNewNotification(notification)); - result.comment(R.string.pumpNotInitializedProfileNotSet); + result.comment(R.string.pump_not_initialized_profile_not_set); return result; } else { rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)); } if (!sExecutionService.updateBasalsInPump(profile)) { - Notification notification = new Notification(Notification.FAILED_UPDATE_PROFILE, getRh().gs(R.string.failedupdatebasalprofile), Notification.URGENT); + Notification notification = new Notification(Notification.FAILED_UPDATE_PROFILE, getRh().gs(R.string.failed_update_basal_profile), Notification.URGENT); rxBus.send(new EventNewNotification(notification)); - result.comment(R.string.failedupdatebasalprofile); + result.comment(R.string.failed_update_basal_profile); } else { rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)); rxBus.send(new EventDismissNotification(Notification.FAILED_UPDATE_PROFILE)); @@ -401,7 +401,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump if (pumpState.getTemporaryBasal() != null) { extended.put("TempBasalAbsoluteRate", PumpStateExtensionKt.convertedToAbsolute(pumpState.getTemporaryBasal(), now, profile)); extended.put("TempBasalStart", dateUtil.dateAndTimeString(pumpState.getTemporaryBasal().getTimestamp())); - extended.put("TempBasalRemaining", PumpStateExtensionKt.getPlannedRemainingMinutes(pumpState.getTemporaryBasal())); + extended.put("TempBasalRemaining", pumpState.getTemporaryBasal().getPlannedRemainingMinutes()); } if (pumpState.getExtendedBolus() != null) { extended.put("ExtendedBolusAbsoluteRate", pumpState.getExtendedBolus().getRate()); diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt index 81488f2b85..a88baebe05 100644 --- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt +++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt @@ -231,17 +231,17 @@ class DanaRSPlugin @Inject constructor( val result = PumpEnactResult(injector) if (!isInitialized()) { aapsLogger.error("setNewBasalProfile not initialized") - val notification = Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, rh.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT) + val notification = Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, rh.gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT) rxBus.send(EventNewNotification(notification)) - result.comment = rh.gs(R.string.pumpNotInitializedProfileNotSet) + result.comment = rh.gs(R.string.pump_not_initialized_profile_not_set) return result } else { rxBus.send(EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)) } return if (danaRSService?.updateBasalsInPump(profile) != true) { - val notification = Notification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failedupdatebasalprofile), Notification.URGENT) + val notification = Notification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failed_update_basal_profile), Notification.URGENT) rxBus.send(EventNewNotification(notification)) - result.comment = rh.gs(R.string.failedupdatebasalprofile) + result.comment = rh.gs(R.string.failed_update_basal_profile) result } else { rxBus.send(EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)) diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Fragment.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Fragment.kt index b89cdbe6db..ec8fd5ee33 100644 --- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Fragment.kt +++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Fragment.kt @@ -177,7 +177,7 @@ class DiaconnG8Fragment : DaggerFragment() { val todayInsulinLimitAmount = (pump.maxBasal.toInt() * 24) + pump.maxBolusePerDay.toInt() binding.dailyunits.text = rh.gs(R.string.reservoirvalue, todayInsulinAmount, todayInsulinLimitAmount) warnColors.setColor(binding.dailyunits, todayInsulinAmount, todayInsulinLimitAmount * 0.75, todayInsulinLimitAmount * 0.9) - binding.basabasalrate.text = pump.baseInjAmount.toString() + " / " + rh.gs(R.string.pump_basebasalrate, plugin.baseBasalRate) + binding.basabasalrate.text = pump.baseInjAmount.toString() + " / " + rh.gs(R.string.pump_base_basal_rate, plugin.baseBasalRate) binding.tempbasal.text = diaconnG8Pump.temporaryBasalToString() binding.extendedbolus.text = diaconnG8Pump.extendedBolusToString() diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt index 96b26f119c..c2a89982e6 100644 --- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt +++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt @@ -214,17 +214,17 @@ class DiaconnG8Plugin @Inject constructor( override fun setNewBasalProfile(profile: Profile): PumpEnactResult { val result = PumpEnactResult(injector) if (!isInitialized()) { - val notification = Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, rh.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT) + val notification = Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, rh.gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT) rxBus.send(EventNewNotification(notification)) - result.comment = rh.gs(R.string.pumpNotInitializedProfileNotSet) + result.comment = rh.gs(R.string.pump_not_initialized_profile_not_set) return result } else { rxBus.send(EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)) } return if (diaconnG8Service?.updateBasalsInPump(profile) != true) { - val notification = Notification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failedupdatebasalprofile), Notification.URGENT) + val notification = Notification(Notification.FAILED_UPDATE_PROFILE, rh.gs(R.string.failed_update_basal_profile), Notification.URGENT) rxBus.send(EventNewNotification(notification)) - result.comment = rh.gs(R.string.failedupdatebasalprofile) + result.comment = rh.gs(R.string.failed_update_basal_profile) result } else { rxBus.send(EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)) diff --git a/pump/diaconn/src/main/res/layout/diaconn_g8_fragment.xml b/pump/diaconn/src/main/res/layout/diaconn_g8_fragment.xml index 3c82645cfd..50e94a44ed 100644 --- a/pump/diaconn/src/main/res/layout/diaconn_g8_fragment.xml +++ b/pump/diaconn/src/main/res/layout/diaconn_g8_fragment.xml @@ -50,7 +50,7 @@ android:layout_weight="1" android:paddingStart="0dp" android:paddingEnd="5dp" - android:text="@string/serialnumber" + android:text="@string/serial_number" android:textAlignment="viewEnd" android:textSize="14sp" /> @@ -204,7 +204,7 @@ android:layout_weight="1" android:paddingStart="0dp" android:paddingEnd="5dp" - android:text="@string/lastconnection_label" + android:text="@string/last_connection_label" android:textAlignment="viewEnd" android:textSize="14sp" /> @@ -252,7 +252,7 @@ android:layout_weight="1" android:paddingStart="0dp" android:paddingEnd="5dp" - android:text="@string/lastbolus_label" + android:text="@string/last_bolus_label" android:textAlignment="viewEnd" android:textSize="14sp" /> diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/EopatchPumpPlugin.kt b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/EopatchPumpPlugin.kt index 2909a3b01b..840c8f1be7 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/EopatchPumpPlugin.kt +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/EopatchPumpPlugin.kt @@ -300,7 +300,7 @@ class EopatchPumpPlugin @Inject constructor( } while (!patchManager.bolusCurrent.nowBolus.endTimeSynced && isSuccess) rxBus.send(EventOverviewBolusProgress.apply { - status = rh.gs(R.string.bolusdelivered, detailedBolusInfo.insulin) + status = rh.gs(R.string.bolus_delivered, detailedBolusInfo.insulin) percent = 100 }) @@ -329,7 +329,7 @@ class EopatchPumpPlugin @Inject constructor( .observeOn(aapsSchedulers.main) .subscribe { it -> rxBus.send(EventOverviewBolusProgress.apply { - status = rh.gs(R.string.bolusdelivered, (it.injectedBolusAmount * 0.05f)) + status = rh.gs(R.string.bolus_delivered, (it.injectedBolusAmount * 0.05f)) }) } ) diff --git a/pump/eopatch/src/main/res/values/strings.xml b/pump/eopatch/src/main/res/values/strings.xml index 630f405d36..ba0d66d848 100644 --- a/pump/eopatch/src/main/res/values/strings.xml +++ b/pump/eopatch/src/main/res/values/strings.xml @@ -20,7 +20,7 @@ Patch buzzer Reminders h:mm a - Bolus %1$.2f U delivered successfully + Bolus %1$.2f U delivered successfully BLE Status Serial Number Lot Number diff --git a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt index 01a1afe2ab..c0b331c2f5 100644 --- a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt +++ b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt @@ -313,7 +313,7 @@ class MedtronicFragment : DaggerFragment() { // base basal rate binding.baseBasalRate.text = ("(" + medtronicPumpStatus.activeProfileName + ") " - + rh.gs(R.string.pump_basebasalrate, medtronicPumpPlugin.baseBasalRate)) + + rh.gs(R.string.pump_base_basal_rate, medtronicPumpPlugin.baseBasalRate)) // TBR var tbrStr = "" diff --git a/pump/medtronic/src/main/res/layout/medtronic_fragment.xml b/pump/medtronic/src/main/res/layout/medtronic_fragment.xml index fe7d62f235..317a17f431 100644 --- a/pump/medtronic/src/main/res/layout/medtronic_fragment.xml +++ b/pump/medtronic/src/main/res/layout/medtronic_fragment.xml @@ -264,7 +264,7 @@ android:layout_weight="1.5" android:textAlignment="viewEnd" android:paddingEnd="5dp" - android:text="@string/lastconnection_label" + android:text="@string/last_connection_label" android:textSize="14sp" tools:ignore="RtlSymmetry" /> @@ -312,7 +312,7 @@ android:layout_weight="1.5" android:textAlignment="viewEnd" android:paddingEnd="5dp" - android:text="@string/lastbolus_label" + android:text="@string/last_bolus_label" android:textSize="14sp" tools:ignore="RtlSymmetry" /> diff --git a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt index 8b5b41b4f4..9cdc9f7761 100644 --- a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt +++ b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt @@ -384,7 +384,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { podInfoBinding.baseBasalRate.text = if (podStateManager.basalProgram != null && !podStateManager.isSuspended) { rh.gs( - R.string.pump_basebasalrate, + R.string.pump_base_basal_rate, omnipodDashPumpPlugin.model() .determineCorrectBasalSize(podStateManager.basalProgram!!.rateAt(System.currentTimeMillis())) ) diff --git a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java index 5a5989f273..5091d92450 100644 --- a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java +++ b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java @@ -776,7 +776,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley if (tb != null) { extended.put("TempBasalAbsoluteRate", convertedToAbsolute(tb, now, profile)); extended.put("TempBasalStart", dateUtil.dateAndTimeString(tb.getTimestamp())); - extended.put("TempBasalRemaining", getPlannedRemainingMinutes(tb)); + extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes()); } PumpSync.PumpState.ExtendedBolus eb = pumpSync.expectedPumpState().getExtendedBolus(); if (eb != null) { diff --git a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt index 11a0a236d8..547c07fefc 100644 --- a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt +++ b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt @@ -320,7 +320,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() { // base basal rate podInfoBinding.baseBasalRate.text = if (podStateManager.isPodActivationCompleted) { - rh.gs(R.string.pump_basebasalrate, omnipodErosPumpPlugin.model().determineCorrectBasalSize(podStateManager.basalSchedule.rateAt(TimeUtil.toDuration(DateTime.now())))) + rh.gs(R.string.pump_base_basal_rate, omnipodErosPumpPlugin.model().determineCorrectBasalSize(podStateManager.basalSchedule.rateAt(TimeUtil.toDuration(DateTime.now())))) } else { PLACEHOLDER } diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt index a8e7d87ddc..d34df5c300 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt @@ -17,7 +17,6 @@ import androidx.recyclerview.widget.RecyclerView import dagger.android.support.DaggerFragment import info.nightscout.androidaps.extensions.iobCalc import info.nightscout.androidaps.extensions.isInProgress -import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.core.utils.ActionModeHelper @@ -29,6 +28,7 @@ import info.nightscout.database.entities.ValueWithUnit import info.nightscout.database.entities.interfaces.end import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.transactions.InvalidateExtendedBolusTransaction +import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.rx.AapsSchedulers @@ -157,7 +157,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment(), MenuProvider { holder.binding.insulin.text = rh.gs(R.string.format_insulin_units, extendedBolus.amount) val iob = extendedBolus.iobCalc(System.currentTimeMillis(), profile, activePlugin.activeInsulin) holder.binding.iob.text = rh.gs(R.string.format_insulin_units, iob.iob) - holder.binding.ratio.text = rh.gs(R.string.pump_basebasalrate, extendedBolus.rate) + holder.binding.ratio.text = rh.gs(R.string.pump_base_basal_rate, extendedBolus.rate) if (iob.iob != 0.0) holder.binding.iob.setTextColor(rh.gac(context, R.attr.activeColor)) else holder.binding.iob.setTextColor(holder.binding.insulin.currentTextColor) holder.binding.cbRemove.visibility = (extendedBolus.isValid && actionHelper.isRemoving).toVisibility() if (actionHelper.isRemoving) { diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt index b0aa63f105..6affe39cb4 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt @@ -188,7 +188,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment(), MenuProvider { holder.binding.time.setTextColor(holder.binding.duration.currentTextColor) } holder.binding.duration.text = rh.gs(R.string.format_mins, T.msecs(tempBasal.duration).mins()) - if (tempBasal.isAbsolute) holder.binding.rate.text = rh.gs(R.string.pump_basebasalrate, tempBasal.rate) + if (tempBasal.isAbsolute) holder.binding.rate.text = rh.gs(R.string.pump_base_basal_rate, tempBasal.rate) else holder.binding.rate.text = rh.gs(R.string.format_percent, tempBasal.rate.toInt()) val now = dateUtil.now() var iob = IobTotal(now) diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/TempBasalDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/TempBasalDialog.kt index 04403dd6f2..ae443cdbd1 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/TempBasalDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/TempBasalDialog.kt @@ -6,7 +6,6 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.google.common.base.Joiner -import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.core.utils.extensions.formatColor @@ -14,6 +13,7 @@ import info.nightscout.database.entities.UserEntry import info.nightscout.database.entities.ValueWithUnit import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Constraints +import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.protection.ProtectionCheck @@ -125,7 +125,7 @@ class TempBasalDialog : DialogFragmentWithDate() { } else { val basalAbsoluteInput = SafeParse.stringToDouble(binding.basalAbsoluteInput.text) absolute = constraintChecker.applyBasalConstraints(Constraint(basalAbsoluteInput), profile).value() - actions.add(rh.gs(R.string.tempbasal_label) + ": " + rh.gs(R.string.pump_basebasalrate, absolute)) + actions.add(rh.gs(R.string.tempbasal_label) + ": " + rh.gs(R.string.pump_base_basal_rate, absolute)) actions.add(rh.gs(R.string.duration) + ": " + rh.gs(R.string.format_mins, durationInMinutes)) if (abs(absolute - basalAbsoluteInput) > 0.01) actions.add(rh.gs(R.string.constraint_applied).formatColor(context, rh, R.attr.warningColor))