Handle received EventNewBg depending on args.

(cherry picked from commit 79b7a7b)
This commit is contained in:
Johannes Mockenhaupt 2018-03-17 13:25:37 +01:00
parent 7f45316a24
commit ad3bf19e4c
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
5 changed files with 10 additions and 3 deletions

View file

@ -531,6 +531,8 @@ public class IobCobCalculatorPlugin implements PluginBase {
@Subscribe
public void onEventNewBG(EventNewBG ev) {
if (!ev.isActiveBgSource)
return;
if (this != getPlugin()) {
log.debug("Ignoring event for non default instance");
return;

View file

@ -142,6 +142,8 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
@Subscribe
public void onStatusEvent(final EventNewBG e) {
if (!e.isActiveBgSource || !e.isNew)
return;
Activity activity = getActivity();
if (activity != null)
activity.runOnUiThread(new Runnable() {

View file

@ -255,7 +255,8 @@ public class PersistentNotificationPlugin implements PluginBase {
@Subscribe
public void onStatusEvent(final EventNewBG ev) {
updateNotification();
if (ev.isActiveBgSource && ev.isNew)
updateNotification();
}
@Subscribe

View file

@ -182,7 +182,8 @@ public class WearPlugin implements PluginBase {
@Subscribe
public void onStatusEvent(final EventNewBG ev) {
sendDataToWatch(true, true, true);
if (ev.isActiveBgSource)
sendDataToWatch(true, true, true);
}
@Subscribe

View file

@ -235,7 +235,8 @@ public class StatuslinePlugin implements PluginBase {
@Subscribe
public void onStatusEvent(final EventNewBG ev) {
sendStatus();
if (ev.isActiveBgSource && ev.isNew)
sendStatus();
}
@Subscribe