smarter plugin selection and handling

This commit is contained in:
Milos Kozak 2016-12-11 22:55:45 +01:00
parent 8f6f6e326d
commit 4a2a15d394
22 changed files with 138 additions and 88 deletions

View file

@ -30,12 +30,12 @@ public class ActionsPlugin implements PluginBase {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == GENERAL && fragmentEnabled;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return fragmentVisible; return type == GENERAL && fragmentVisible;
} }
@Override @Override
@ -45,12 +45,12 @@ public class ActionsPlugin implements PluginBase {
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
this.fragmentEnabled = fragmentEnabled; if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible; if (type == GENERAL) this.fragmentVisible = fragmentVisible;
} }
} }

View file

@ -26,12 +26,12 @@ public class CareportalPlugin implements PluginBase {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == GENERAL && fragmentEnabled;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return fragmentVisible; return type == GENERAL && fragmentVisible;
} }
@Override @Override
@ -41,12 +41,12 @@ public class CareportalPlugin implements PluginBase {
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
this.fragmentEnabled = fragmentEnabled; if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible; if (type == GENERAL) this.fragmentVisible = fragmentVisible;
} }
} }

View file

@ -69,12 +69,12 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == PROFILE && fragmentEnabled;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return fragmentVisible; return type == PROFILE && fragmentVisible;
} }
@Override @Override
@ -84,12 +84,12 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
this.fragmentEnabled = fragmentEnabled; if (type == PROFILE) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible; if (type == PROFILE) this.fragmentVisible = fragmentVisible;
} }
void storeSettings() { void storeSettings() {

View file

@ -21,6 +21,7 @@ import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.events.EventRefreshGui;
@ -34,6 +35,8 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.interfaces.TempBasalsInterface; import info.nightscout.androidaps.interfaces.TempBasalsInterface;
import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.plugins.Loop.LoopFragment; import info.nightscout.androidaps.plugins.Loop.LoopFragment;
import info.nightscout.androidaps.plugins.NSProfileViewer.NSProfileViewerPlugin;
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpPlugin;
public class ConfigBuilderFragment extends Fragment implements FragmentBase { public class ConfigBuilderFragment extends Fragment implements FragmentBase {
@ -93,7 +96,8 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
nsclientVerView.setText(ConfigBuilderPlugin.nsClientVersionName); nsclientVerView.setText(ConfigBuilderPlugin.nsClientVersionName);
nightscoutVerView.setText(ConfigBuilderPlugin.nightscoutVersionName); nightscoutVerView.setText(ConfigBuilderPlugin.nightscoutVersionName);
if (ConfigBuilderPlugin.nsClientVersionCode < 117) nsclientVerView.setTextColor(Color.RED); if (ConfigBuilderPlugin.nsClientVersionCode < 117) nsclientVerView.setTextColor(Color.RED);
if (ConfigBuilderPlugin.nightscoutVersionCode < 900) nightscoutVerView.setTextColor(Color.RED); if (ConfigBuilderPlugin.nightscoutVersionCode < 900)
nightscoutVerView.setTextColor(Color.RED);
setViews(); setViews();
return view; return view;
} }
@ -179,6 +183,7 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
onEnabledCategoryChanged(plugin, type); onEnabledCategoryChanged(plugin, type);
configBuilderPlugin.storeSettings(); configBuilderPlugin.storeSettings();
MainApp.bus().post(new EventRefreshGui(true)); MainApp.bus().post(new EventRefreshGui(true));
getPlugin().logPluginStatus();
} }
}); });
@ -189,6 +194,7 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
plugin.setFragmentVisible(type, cb.isChecked()); plugin.setFragmentVisible(type, cb.isChecked());
configBuilderPlugin.storeSettings(); configBuilderPlugin.storeSettings();
MainApp.bus().post(new EventRefreshGui(true)); MainApp.bus().post(new EventRefreshGui(true));
getPlugin().logPluginStatus();
} }
}); });
} else { } else {
@ -213,6 +219,7 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
if (pluginList.size() < 2) { if (pluginList.size() < 2) {
holder.checkboxEnabled.setEnabled(false); holder.checkboxEnabled.setEnabled(false);
plugin.setFragmentEnabled(type, true); plugin.setFragmentEnabled(type, true);
getPlugin().storeSettings();
} }
// Constraints cannot be disabled // Constraints cannot be disabled
@ -246,9 +253,8 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
} }
void onEnabledCategoryChanged(PluginBase changedPlugin, int type) { void onEnabledCategoryChanged(PluginBase changedPlugin, int type) {
int category = changedPlugin.getType();
ArrayList<PluginBase> pluginsInCategory = null; ArrayList<PluginBase> pluginsInCategory = null;
switch (category) { switch (type) {
// Multiple selection allowed // Multiple selection allowed
case PluginBase.GENERAL: case PluginBase.GENERAL:
case PluginBase.CONSTRAINTS: case PluginBase.CONSTRAINTS:
@ -267,7 +273,7 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
case PluginBase.TEMPBASAL: case PluginBase.TEMPBASAL:
case PluginBase.TREATMENT: case PluginBase.TREATMENT:
case PluginBase.PUMP: case PluginBase.PUMP:
pluginsInCategory = MainApp.getSpecificPluginsList(category); pluginsInCategory = MainApp.getSpecificPluginsListByInterface(PumpInterface.class);
break; break;
} }
if (pluginsInCategory != null) { if (pluginsInCategory != null) {
@ -282,6 +288,11 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
} }
} }
} else { // enable first plugin in list } else { // enable first plugin in list
if (type == PluginBase.PUMP)
MainApp.getSpecificPlugin(VirtualPumpPlugin.class).setFragmentEnabled(type, true);
else if (type == PluginBase.PROFILE)
MainApp.getSpecificPlugin(NSProfileViewerPlugin.class).setFragmentEnabled(type, true);
else
pluginsInCategory.get(0).setFragmentEnabled(type, true); pluginsInCategory.get(0).setFragmentEnabled(type, true);
} }
setViews(); setViews();

View file

@ -98,12 +98,12 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return true; return type == GENERAL && true;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return true; return type == GENERAL && true;
} }
@Override @Override
@ -192,6 +192,22 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
return activeLoop; return activeLoop;
} }
public void logPluginStatus() {
for (PluginBase p : pluginList) {
log.debug(p.getName() + ":" +
(p.isEnabled(1) ? " GENERAL" : "") +
(p.isEnabled(2) ? " TREATMENT" : "") +
(p.isEnabled(3) ? " TEMPBASAL" : "") +
(p.isEnabled(4) ? " PROFILE" : "") +
(p.isEnabled(5) ? " APS" : "") +
(p.isEnabled(6) ? " PUMP" : "") +
(p.isEnabled(7) ? " CONSTRAINTS" : "") +
(p.isEnabled(8) ? " LOOP" : "") +
(p.isEnabled(9) ? " BGSOURCE" : "")
);
}
}
private void verifySelectionInCategories() { private void verifySelectionInCategories() {
ArrayList<PluginBase> pluginsInCategory; ArrayList<PluginBase> pluginsInCategory;

View file

@ -36,6 +36,7 @@ import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.DanaR.Services.ExecutionService; import info.nightscout.androidaps.plugins.DanaR.Services.ExecutionService;
import info.nightscout.androidaps.plugins.NSProfileViewer.NSProfileViewerPlugin;
import info.nightscout.client.data.NSProfile; import info.nightscout.client.data.NSProfile;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
@ -173,8 +174,17 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
if (type == PluginBase.PROFILE) this.fragmentProfileEnabled = fragmentEnabled; if (type == PluginBase.PROFILE)
else if (type == PluginBase.PUMP) this.fragmentPumpEnabled = fragmentEnabled; this.fragmentProfileEnabled = fragmentEnabled;
else if (type == PluginBase.PUMP)
this.fragmentPumpEnabled = fragmentEnabled;
// if pump profile was enabled need to switch to another too
if (type == PluginBase.PUMP && !fragmentEnabled && this.fragmentProfileEnabled) {
setFragmentEnabled(PluginBase.PROFILE, false);
setFragmentVisible(PluginBase.PROFILE, false);
MainApp.getSpecificPlugin(NSProfileViewerPlugin.class).setFragmentEnabled(PluginBase.PROFILE, true);
MainApp.getSpecificPlugin(NSProfileViewerPlugin.class).setFragmentVisible(PluginBase.PROFILE, true);
}
} }
@Override @Override
@ -648,7 +658,8 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
extended.put("BaseBasalRate", getBaseBasalRate()); extended.put("BaseBasalRate", getBaseBasalRate());
try { try {
extended.put("ActiveProfile", MainApp.getConfigBuilder().getActiveProfile().getProfile().getActiveProfile()); extended.put("ActiveProfile", MainApp.getConfigBuilder().getActiveProfile().getProfile().getActiveProfile());
} catch (Exception e) {} } catch (Exception e) {
}
pump.put("battery", battery); pump.put("battery", battery);
pump.put("status", status); pump.put("status", status);

View file

@ -36,6 +36,7 @@ import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.DanaRKorean.Services.ExecutionService; import info.nightscout.androidaps.plugins.DanaRKorean.Services.ExecutionService;
import info.nightscout.androidaps.plugins.NSProfileViewer.NSProfileViewerPlugin;
import info.nightscout.client.data.NSProfile; import info.nightscout.client.data.NSProfile;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
@ -173,8 +174,17 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
if (type == PluginBase.PROFILE) this.fragmentProfileEnabled = fragmentEnabled; if (type == PluginBase.PROFILE)
else if (type == PluginBase.PUMP) this.fragmentPumpEnabled = fragmentEnabled; this.fragmentProfileEnabled = fragmentEnabled;
else if (type == PluginBase.PUMP)
this.fragmentPumpEnabled = fragmentEnabled;
// if pump profile was enabled need to switch to another too
if (type == PluginBase.PUMP && !fragmentEnabled && this.fragmentProfileEnabled) {
setFragmentEnabled(PluginBase.PROFILE, false);
setFragmentVisible(PluginBase.PROFILE, false);
MainApp.getSpecificPlugin(NSProfileViewerPlugin.class).setFragmentEnabled(PluginBase.PROFILE, true);
MainApp.getSpecificPlugin(NSProfileViewerPlugin.class).setFragmentVisible(PluginBase.PROFILE, true);
}
} }
@Override @Override

View file

@ -83,12 +83,12 @@ public class LoopPlugin implements PluginBase {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == LOOP && fragmentEnabled;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return fragmentVisible; return type == LOOP && fragmentVisible;
} }
@Override @Override
@ -98,12 +98,12 @@ public class LoopPlugin implements PluginBase {
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
this.fragmentEnabled = fragmentEnabled; if (type == LOOP) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible; if (type == LOOP) this.fragmentVisible = fragmentVisible;
} }
@Subscribe @Subscribe

View file

@ -51,12 +51,12 @@ public class NSProfileViewerPlugin implements PluginBase, ProfileInterface {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == PROFILE && fragmentEnabled;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return fragmentVisible; return type == PROFILE && fragmentVisible;
} }
@Override @Override
@ -66,12 +66,12 @@ public class NSProfileViewerPlugin implements PluginBase, ProfileInterface {
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
this.fragmentEnabled = fragmentEnabled; if (type == PROFILE) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible; if (type == PROFILE) this.fragmentVisible = fragmentVisible;
} }
@Override @Override

View file

@ -51,13 +51,13 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return true; return type == CONSTRAINTS;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
LoopPlugin loopPlugin = (LoopPlugin) MainApp.getSpecificPlugin(LoopPlugin.class); LoopPlugin loopPlugin = (LoopPlugin) MainApp.getSpecificPlugin(LoopPlugin.class);
return fragmentVisible && loopPlugin != null && loopPlugin.isVisibleInTabs(type); return type == CONSTRAINTS && fragmentVisible && loopPlugin != null && loopPlugin.isVisibleInTabs(type);
} }
@Override @Override
@ -71,7 +71,7 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface {
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible; if (type == CONSTRAINTS) this.fragmentVisible = fragmentVisible;
} }
public class Objective { public class Objective {

View file

@ -58,12 +58,12 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == APS && fragmentEnabled;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return fragmentVisible; return type == APS && fragmentVisible;
} }
@Override @Override
@ -73,12 +73,12 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible; if (type == APS) this.fragmentVisible = fragmentVisible;
} }
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
this.fragmentEnabled = fragmentEnabled; if (type == APS) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override

View file

@ -49,7 +49,7 @@ public class OverviewPlugin implements PluginBase {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return true; return type == GENERAL;
} }
@Override @Override

View file

@ -40,7 +40,7 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return true; return type == CONSTRAINTS;
} }
@Override @Override
@ -54,7 +54,7 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface {
} }
@Override @Override
public void setFragmentEnabled(int tyep, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
} }

View file

@ -60,12 +60,12 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == PROFILE && fragmentEnabled;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return fragmentVisible; return type == PROFILE && fragmentVisible;
} }
@Override @Override
@ -75,12 +75,12 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
this.fragmentEnabled = fragmentEnabled; if (type == PROFILE) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible; if (type == PROFILE) this.fragmentVisible = fragmentVisible;
} }
public void storeSettings() { public void storeSettings() {

View file

@ -100,12 +100,12 @@ public class SmsCommunicatorPlugin implements PluginBase {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == GENERAL && fragmentEnabled;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return fragmentVisible; return type == GENERAL && fragmentVisible;
} }
@Override @Override
@ -115,12 +115,12 @@ public class SmsCommunicatorPlugin implements PluginBase {
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
SmsCommunicatorPlugin.fragmentEnabled = fragmentEnabled; if (type == GENERAL) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
SmsCommunicatorPlugin.fragmentVisible = fragmentVisible; if (type == GENERAL) this.fragmentEnabled = fragmentVisible;
} }
@Subscribe @Subscribe

View file

@ -28,7 +28,7 @@ public class SourceNSClientPlugin implements PluginBase, BgSourceInterface {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == BGSOURCE && fragmentEnabled;
} }
@Override @Override
@ -43,7 +43,7 @@ public class SourceNSClientPlugin implements PluginBase, BgSourceInterface {
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
this.fragmentEnabled = fragmentEnabled; if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override

View file

@ -30,7 +30,7 @@ public class SourceXdripPlugin implements PluginBase, BgSourceInterface {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == BGSOURCE && fragmentEnabled;
} }
@Override @Override
@ -45,7 +45,7 @@ public class SourceXdripPlugin implements PluginBase, BgSourceInterface {
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
SourceXdripPlugin.fragmentEnabled = fragmentEnabled; if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override

View file

@ -66,12 +66,12 @@ public class TempBasalsPlugin implements PluginBase, TempBasalsInterface {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == TEMPBASAL && fragmentEnabled;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return fragmentVisible; return type == TEMPBASAL && fragmentVisible;
} }
@Override @Override
@ -81,12 +81,12 @@ public class TempBasalsPlugin implements PluginBase, TempBasalsInterface {
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
this.fragmentEnabled = fragmentEnabled; if (type == TEMPBASAL) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible; if (type == TEMPBASAL) this.fragmentVisible = fragmentVisible;
} }
@Override @Override

View file

@ -49,12 +49,12 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == TREATMENT && fragmentEnabled;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return fragmentVisible; return type == TREATMENT && fragmentVisible;
} }
@Override @Override
@ -64,12 +64,12 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
this.fragmentEnabled = fragmentEnabled; if (type == TREATMENT) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible; if (type == TREATMENT) this.fragmentVisible = fragmentVisible;
} }
@Override @Override

View file

@ -80,12 +80,12 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == PUMP && fragmentEnabled;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return fragmentVisible; return type == PUMP && fragmentVisible;
} }
@Override @Override
@ -95,12 +95,12 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
this.fragmentEnabled = fragmentEnabled; if (type == PUMP) this.fragmentEnabled = fragmentEnabled;
} }
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible; if (type == PUMP) this.fragmentVisible = fragmentVisible;
} }
@Override @Override

View file

@ -50,12 +50,12 @@ public class WearPlugin implements PluginBase {
@Override @Override
public boolean isEnabled(int type) { public boolean isEnabled(int type) {
return fragmentEnabled; return type == GENERAL && fragmentEnabled;
} }
@Override @Override
public boolean isVisibleInTabs(int type) { public boolean isVisibleInTabs(int type) {
return fragmentVisible; return type == GENERAL && fragmentVisible;
} }
@Override @Override
@ -65,15 +65,17 @@ public class WearPlugin implements PluginBase {
@Override @Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) { public void setFragmentEnabled(int type, boolean fragmentEnabled) {
WearPlugin.fragmentEnabled = fragmentEnabled; if (type == GENERAL) {
this.fragmentEnabled = fragmentEnabled;
if (watchUS != null) { if (watchUS != null) {
watchUS.setSettings(); watchUS.setSettings();
} }
} }
}
@Override @Override
public void setFragmentVisible(int type, boolean fragmentVisible) { public void setFragmentVisible(int type, boolean fragmentVisible) {
WearPlugin.fragmentVisible = fragmentVisible; if (type == GENERAL) this.fragmentVisible = fragmentVisible;
} }
private void sendDataToWatch(boolean status, boolean basals, boolean bgValue) { private void sendDataToWatch(boolean status, boolean basals, boolean bgValue) {

View file

@ -43,6 +43,13 @@
<sourceFolder url="file://$MODULE_DIR$/src/fullDebug/jni" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/fullDebug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/fullDebug/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/fullDebug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/fullDebug/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/fullDebug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/full/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/full/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/assets" type="java-test-resource" />
@ -51,13 +58,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/jni" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/full/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/full/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/full/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/full/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/full/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/full/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/full/assets" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/full/assets" type="java-resource" />