From f75c2f8f916cee5586d40f03bc26eb6c6be38176 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 9 Dec 2016 11:31:45 +0100 Subject: [PATCH] check if plugin is enabled before accepting message --- .../androidaps/plugins/DanaR/DanaRPlugin.java | 12 +++++++----- .../plugins/DanaRKorean/DanaRKoreanPlugin.java | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java index 0dc2065b56..4e7c187768 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java @@ -102,11 +102,13 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf @Subscribe public void onStatusEvent(final EventPreferenceChange s) { - boolean previousValue = useExtendedBoluses; - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); - useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false); - if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) { - sExecutionService.extendedBolusStop(); + if (isEnabled(PUMP)) { + boolean previousValue = useExtendedBoluses; + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); + useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false); + if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) { + sExecutionService.extendedBolusStop(); + } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/DanaRKoreanPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/DanaRKoreanPlugin.java index 145c72d154..740cdc791c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/DanaRKoreanPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/DanaRKoreanPlugin.java @@ -101,11 +101,13 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints @Subscribe public void onStatusEvent(final EventPreferenceChange s) { - boolean previousValue = useExtendedBoluses; - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); - useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false); - if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) { - sExecutionService.extendedBolusStop(); + if (isEnabled(PUMP)) { + boolean previousValue = useExtendedBoluses; + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); + useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false); + if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) { + sExecutionService.extendedBolusStop(); + } } }