From 63b9a06431d751de5ce886ad937f56ad7d64dd97 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Mon, 8 May 2017 16:34:45 +0200 Subject: [PATCH] Send empty status to xDrip when disabled. Send status immediately when enabling plugin. --- .../XDripStatusline/StatuslinePlugin.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java index 7e999d742d..3cd1f8fe27 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java @@ -45,8 +45,9 @@ public class StatuslinePlugin implements PluginBase { this.ctx = ctx; this.mPrefs = PreferenceManager.getDefaultSharedPreferences(ctx); - if (fragmentEnabled) + if (fragmentEnabled) { MainApp.bus().register(this); + } } @Override @@ -105,10 +106,14 @@ public class StatuslinePlugin implements PluginBase { if (type == GENERAL) { this.fragmentEnabled = fragmentEnabled; - if (fragmentEnabled) + if (fragmentEnabled) { MainApp.bus().register(this); - else + sendStatus(); + } + else{ MainApp.bus().unregister(this); + sendStatus(); + } } } @@ -120,7 +125,13 @@ public class StatuslinePlugin implements PluginBase { private void sendStatus() { - String status = buildStatusString(); + + String status = ""; // sent once on disable + + if(fragmentEnabled) { + status = buildStatusString(); + } + //sendData final Bundle bundle = new Bundle();