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 5ec8cf34ec..372a0a6651 100644 --- a/app/src/main/java/info/nightscout/androidaps/Services/DataService.java +++ b/app/src/main/java/info/nightscout/androidaps/Services/DataService.java @@ -37,14 +37,12 @@ import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventNewBasalProfile; import info.nightscout.androidaps.events.EventTreatmentChange; import info.nightscout.androidaps.interfaces.PumpInterface; -import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.DanaR.History.DanaRNSHistorySync; -import info.nightscout.androidaps.plugins.Objectives.ObjectivesFragment; import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin; -import info.nightscout.androidaps.plugins.Overview.OverviewFragment; -import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventNewSMS; +import info.nightscout.androidaps.plugins.Overview.OverviewPlugin; import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorFragment; +import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventNewSMS; import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientFragment; import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripFragment; import info.nightscout.androidaps.receivers.DataReceiver; @@ -200,12 +198,11 @@ public class DataService extends IntentService { JSONObject settings = statusJson.getJSONObject("settings"); if (settings.has("thresholds")) { JSONObject thresholds = settings.getJSONObject("thresholds"); - OverviewFragment overviewFragment = (OverviewFragment) MainApp.getSpecificPlugin(OverviewFragment.class); - if (overviewFragment != null && thresholds.has("bgTargetTop")) { - overviewFragment.bgTargetHigh = thresholds.getDouble("bgTargetTop"); + if (thresholds.has("bgTargetTop")) { + OverviewPlugin.bgTargetHigh = thresholds.getDouble("bgTargetTop"); } - if (overviewFragment != null && thresholds.has("bgTargetBottom")) { - overviewFragment.bgTargetLow = thresholds.getDouble("bgTargetBottom"); + if (thresholds.has("bgTargetBottom")) { + OverviewPlugin.bgTargetLow = thresholds.getDouble("bgTargetBottom"); } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 10ed20797d..1c225fc73a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -98,9 +98,6 @@ public class OverviewFragment extends Fragment { private static Handler sHandler; private static HandlerThread sHandlerThread; - public Double bgTargetLow = 80d; - public Double bgTargetHigh = 180d; - public OverviewFragment() { super(); if (sHandlerThread == null) { @@ -419,8 +416,8 @@ public class OverviewFragment extends Fragment { long toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding long fromTime = toTime - hoursToFetch * 60 * 60 * 1000L; - Double lowLine = NSProfile.fromMgdlToUnits(bgTargetLow, units); - Double highLine = NSProfile.fromMgdlToUnits(bgTargetHigh, units); + Double lowLine = NSProfile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units); + Double highLine = NSProfile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units); BarGraphSeries basalsSeries = null; LineGraphSeries seriesLow = null; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewPlugin.java index c647b99ddf..d8217241ee 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewPlugin.java @@ -9,6 +9,9 @@ import info.nightscout.androidaps.interfaces.PluginBase; */ public class OverviewPlugin implements PluginBase { + public static Double bgTargetLow = 80d; + public static Double bgTargetHigh = 180d; + @Override public String getFragmentClass() { return OverviewFragment.class.getName(); diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 051968c5aa..1d5e067026 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -20,7 +20,7 @@ #830400 #190084 - #FF478EFF - #779ECB + #779ECB + #FF478EFF