fix state plugin change handling

This commit is contained in:
Milos Kozak 2018-08-01 23:26:01 +02:00
parent c0a3eb67ba
commit 6544191c78
2 changed files with 2 additions and 2 deletions

View file

@ -120,7 +120,7 @@ public abstract class PluginBase {
} }
} else { // disabling plugin } else { // disabling plugin
if (state == State.ENABLED) { if (state == State.ENABLED) {
onStateChange(type, state, State.ENABLED); onStateChange(type, state, State.DISABLED);
state = State.DISABLED; state = State.DISABLED;
onStop(); onStop();
if (L.isEnabled(L.CORE)) if (L.isEnabled(L.CORE))

View file

@ -67,7 +67,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
@Override @Override
public void onStateChange(PluginType type, State oldState, State newState) { public void onStateChange(PluginType type, State oldState, State newState) {
// if pump profile was enabled need to switch to another too // if pump profile was enabled need to switch to another too
if (type == PluginType.PUMP && newState == State.ENABLED && newState == State.DISABLED && isProfileInterfaceEnabled) { if (type == PluginType.PUMP && newState == State.DISABLED && isProfileInterfaceEnabled) {
setPluginEnabled(PluginType.PROFILE, false); setPluginEnabled(PluginType.PROFILE, false);
NSProfilePlugin.getPlugin().setPluginEnabled(PluginType.PROFILE, true); NSProfilePlugin.getPlugin().setPluginEnabled(PluginType.PROFILE, true);
NSProfilePlugin.getPlugin().setFragmentVisible(PluginType.PROFILE, true); NSProfilePlugin.getPlugin().setFragmentVisible(PluginType.PROFILE, true);