diff --git a/primitiveFTPd/src/org/primftpd/services/QuickSettingsService.java b/primitiveFTPd/src/org/primftpd/services/QuickSettingsService.java index bb832553..d6f83ef8 100644 --- a/primitiveFTPd/src/org/primftpd/services/QuickSettingsService.java +++ b/primitiveFTPd/src/org/primftpd/services/QuickSettingsService.java @@ -6,7 +6,11 @@ import android.service.quicksettings.Tile; import android.service.quicksettings.TileService; +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; import org.primftpd.R; +import org.primftpd.events.ServerStateChangedEvent; import org.primftpd.prefs.LoadPrefsUtil; import org.primftpd.util.ServersRunningBean; import org.primftpd.util.ServicesStartStopUtil; @@ -96,6 +100,7 @@ public void onStartListening() { logger.debug("onStartListening"); super.onStartListening(); updateTile(); + EventBus.getDefault().register(this); } @Override @@ -103,6 +108,13 @@ public void onStopListening() { logger.debug("onStopListening"); super.onStopListening(); updateTile(); + EventBus.getDefault().unregister(this); + } + + @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) + public void onEvent(ServerStateChangedEvent event) { + logger.debug("got ServerStateChangedEvent"); + updateTile(); } /**