diff --git a/app/src/main/java/info/nightscout/androidaps/Services/DataService.java b/app/src/main/java/info/nightscout/androidaps/Services/DataService.java index 372a0a6651..43ac96eb0b 100644 --- a/app/src/main/java/info/nightscout/androidaps/Services/DataService.java +++ b/app/src/main/java/info/nightscout/androidaps/Services/DataService.java @@ -379,11 +379,8 @@ public class DataService extends IntentService { MainApp.bus().post(new EventNewBG()); } // Objectives 0 - ObjectivesPlugin objectivesPlugin = (ObjectivesPlugin) MainApp.getSpecificPlugin(ObjectivesPlugin.class); - if (objectivesPlugin != null) { - objectivesPlugin.bgIsAvailableInNS = true; - objectivesPlugin.saveProgress(); - } + ObjectivesPlugin.bgIsAvailableInNS = true; + ObjectivesPlugin.saveProgress(); } if (intent.getAction().equals(Intents.ACTION_NEW_MBG)) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Objectives/ObjectivesPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Objectives/ObjectivesPlugin.java index 2751837b86..5d25bed6e9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Objectives/ObjectivesPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Objectives/ObjectivesPlugin.java @@ -23,7 +23,7 @@ import info.nightscout.androidaps.plugins.Loop.LoopPlugin; public class ObjectivesPlugin implements PluginBase, ConstraintsInterface { private static Logger log = LoggerFactory.getLogger(ObjectivesPlugin.class); - public List objectives; + public static List objectives; boolean fragmentVisible = true; @@ -92,11 +92,11 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface { } // Objective 0 - public boolean bgIsAvailableInNS = false; - public boolean pumpStatusIsAvailableInNS = false; + public static boolean bgIsAvailableInNS = false; + public static boolean pumpStatusIsAvailableInNS = false; // Objective 1 - public Integer manualEnacts = 0; - public final Integer manualEnactsNeeded = 20; + public static Integer manualEnacts = 0; + public static final Integer manualEnactsNeeded = 20; public class RequirementResult { boolean done = false; @@ -176,7 +176,7 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface { new Date(0, 0, 0))); } - public void saveProgress() { + public static void saveProgress() { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); SharedPreferences.Editor editor = settings.edit(); for (int num = 0; num < objectives.size(); num++) {