Send empty status to xDrip when disabled. Send status immediately when enabling plugin.

This commit is contained in:
AdrianLxM 2017-05-08 16:34:45 +02:00
parent da0334eb19
commit 63b9a06431

View file

@ -45,8 +45,9 @@ public class StatuslinePlugin implements PluginBase {
this.ctx = ctx; this.ctx = ctx;
this.mPrefs = PreferenceManager.getDefaultSharedPreferences(ctx); this.mPrefs = PreferenceManager.getDefaultSharedPreferences(ctx);
if (fragmentEnabled) if (fragmentEnabled) {
MainApp.bus().register(this); MainApp.bus().register(this);
}
} }
@Override @Override
@ -105,10 +106,14 @@ public class StatuslinePlugin implements PluginBase {
if (type == GENERAL) { if (type == GENERAL) {
this.fragmentEnabled = fragmentEnabled; this.fragmentEnabled = fragmentEnabled;
if (fragmentEnabled) if (fragmentEnabled) {
MainApp.bus().register(this); MainApp.bus().register(this);
else sendStatus();
}
else{
MainApp.bus().unregister(this); MainApp.bus().unregister(this);
sendStatus();
}
} }
} }
@ -120,7 +125,13 @@ public class StatuslinePlugin implements PluginBase {
private void sendStatus() { private void sendStatus() {
String status = buildStatusString();
String status = ""; // sent once on disable
if(fragmentEnabled) {
status = buildStatusString();
}
//sendData //sendData
final Bundle bundle = new Bundle(); final Bundle bundle = new Bundle();