diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 71a32cb5b4..4a81dea124 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -204,6 +204,21 @@ public class MainApp extends Application { return newList; } + public static ArrayList getSpecificPluginsVisibleInList(int type) { + ArrayList newList = new ArrayList<>(); + + if (pluginsList != null) { + for (PluginBase p : pluginsList) { + if (p.getType() == type) + if (p.showInList(type)) + newList.add(p); + } + } else { + log.error("pluginsList=null"); + } + return newList; + } + public static ArrayList getSpecificPluginsListByInterface(Class interfaceClass) { ArrayList newList = new ArrayList<>(); @@ -218,6 +233,21 @@ public class MainApp extends Application { return newList; } + public static ArrayList getSpecificPluginsVisibleInListByInterface(Class interfaceClass, int type) { + ArrayList newList = new ArrayList<>(); + + if (pluginsList != null) { + for (PluginBase p : pluginsList) { + if (p.getClass() != ConfigBuilderPlugin.class && interfaceClass.isAssignableFrom(p.getClass())) + if (p.showInList(type)) + newList.add(p); + } + } else { + log.error("pluginsList=null"); + } + return newList; + } + @Nullable public static PluginBase getSpecificPlugin(Class pluginClass) { if (pluginsList != null) { diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java index 357737aa65..efbd51ea72 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java @@ -26,6 +26,8 @@ public interface PluginBase { boolean isEnabled(int type); boolean isVisibleInTabs(int type); boolean canBeHidden(int type); + boolean hasFragment(); + boolean showInList(int type); void setFragmentEnabled(int type, boolean fragmentEnabled); void setFragmentVisible(int type, boolean fragmentVisible); } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsPlugin.java index eedd0e4baf..d6ef13b29d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsPlugin.java @@ -54,6 +54,16 @@ public class ActionsPlugin implements PluginBase { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == GENERAL) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalPlugin.java index 9fd4cbca85..e6981083d0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalPlugin.java @@ -50,6 +50,16 @@ public class CareportalPlugin implements PluginBase { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == GENERAL) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java index 4569c4b2f9..8dc546a1f8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java @@ -134,44 +134,44 @@ public class ConfigBuilderFragment extends Fragment { } void setViews() { - insulinDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsListByInterface(InsulinInterface.class), PluginBase.INSULIN); + insulinDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(InsulinInterface.class, PluginBase.INSULIN), PluginBase.INSULIN); insulinListView.setAdapter(insulinDataAdapter); setListViewHeightBasedOnChildren(insulinListView); - bgsourceDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsListByInterface(BgSourceInterface.class), PluginBase.BGSOURCE); + bgsourceDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(BgSourceInterface.class, PluginBase.BGSOURCE), PluginBase.BGSOURCE); bgsourceListView.setAdapter(bgsourceDataAdapter); setListViewHeightBasedOnChildren(bgsourceListView); - pumpDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsList(PluginBase.PUMP), PluginBase.PUMP); + pumpDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.PUMP), PluginBase.PUMP); pumpListView.setAdapter(pumpDataAdapter); - if (MainApp.getSpecificPluginsList(PluginBase.PUMP).size() == 0) + if (MainApp.getSpecificPluginsVisibleInList(PluginBase.PUMP).size() == 0) pumpLabel.setVisibility(View.GONE); setListViewHeightBasedOnChildren(pumpListView); - loopDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsList(PluginBase.LOOP), PluginBase.LOOP); + loopDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.LOOP), PluginBase.LOOP); loopListView.setAdapter(loopDataAdapter); setListViewHeightBasedOnChildren(loopListView); - if (MainApp.getSpecificPluginsList(PluginBase.LOOP).size() == 0) + if (MainApp.getSpecificPluginsVisibleInList(PluginBase.LOOP).size() == 0) loopLabel.setVisibility(View.GONE); - treatmentsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsList(PluginBase.TREATMENT), PluginBase.TREATMENT); + treatmentsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.TREATMENT), PluginBase.TREATMENT); treatmentsListView.setAdapter(treatmentsDataAdapter); setListViewHeightBasedOnChildren(treatmentsListView); - tempsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsList(PluginBase.TEMPBASAL), PluginBase.TEMPBASAL); + tempsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.TEMPBASAL), PluginBase.TEMPBASAL); tempsListView.setAdapter(tempsDataAdapter); setListViewHeightBasedOnChildren(tempsListView); - if (MainApp.getSpecificPluginsList(PluginBase.TEMPBASAL).size() == 0) + if (MainApp.getSpecificPluginsVisibleInList(PluginBase.TEMPBASAL).size() == 0) tempsLabel.setVisibility(View.GONE); - profileDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsListByInterface(ProfileInterface.class), PluginBase.PROFILE); + profileDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(ProfileInterface.class, PluginBase.BGSOURCE), PluginBase.PROFILE); profileListView.setAdapter(profileDataAdapter); setListViewHeightBasedOnChildren(profileListView); - apsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsList(PluginBase.APS), PluginBase.APS); + apsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.APS), PluginBase.APS); apsListView.setAdapter(apsDataAdapter); setListViewHeightBasedOnChildren(apsListView); - if (MainApp.getSpecificPluginsList(PluginBase.APS).size() == 0) + if (MainApp.getSpecificPluginsVisibleInList(PluginBase.APS).size() == 0) apsLabel.setVisibility(View.GONE); - constraintsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class), PluginBase.CONSTRAINTS); + constraintsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(ConstraintsInterface.class, PluginBase.BGSOURCE), PluginBase.CONSTRAINTS); constraintsListView.setAdapter(constraintsDataAdapter); setListViewHeightBasedOnChildren(constraintsListView); - if (MainApp.getSpecificPluginsList(PluginBase.CONSTRAINTS).size() == 0) + if (MainApp.getSpecificPluginsVisibleInList(PluginBase.CONSTRAINTS).size() == 0) constraintsLabel.setVisibility(View.GONE); - generalDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsList(PluginBase.GENERAL), PluginBase.GENERAL); + generalDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginBase.GENERAL), PluginBase.GENERAL); generalListView.setAdapter(generalDataAdapter); setListViewHeightBasedOnChildren(generalListView); @@ -201,18 +201,18 @@ public class ConfigBuilderFragment extends Fragment { } @Override - public View getView(int position, View convertView, ViewGroup parent) { + public View getView(int position, View view, ViewGroup parent) { PluginViewHolder holder = null; - if (convertView == null) { - convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.configbuilder_simpleitem, null); + if (view == null) { + view = LayoutInflater.from(parent.getContext()).inflate(R.layout.configbuilder_simpleitem, null); holder = new PluginViewHolder(); - holder.name = (TextView) convertView.findViewById(R.id.configbuilder_simpleitem_name); - holder.checkboxEnabled = (CheckBox) convertView.findViewById(R.id.configbuilder_simpleitem_checkboxenabled); - holder.checkboxVisible = (CheckBox) convertView.findViewById(R.id.configbuilder_simpleitem_checkboxvisible); - convertView.setTag(holder); + holder.name = (TextView) view.findViewById(R.id.configbuilder_simpleitem_name); + holder.checkboxEnabled = (CheckBox) view.findViewById(R.id.configbuilder_simpleitem_checkboxenabled); + holder.checkboxVisible = (CheckBox) view.findViewById(R.id.configbuilder_simpleitem_checkboxvisible); + view.setTag(holder); holder.checkboxEnabled.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { @@ -240,7 +240,7 @@ public class ConfigBuilderFragment extends Fragment { } }); } else { - holder = (PluginViewHolder) convertView.getTag(); + holder = (PluginViewHolder) view.getTag(); } PluginBase plugin = pluginList.get(position); @@ -260,6 +260,10 @@ public class ConfigBuilderFragment extends Fragment { holder.checkboxVisible.setEnabled(false); } + if (!plugin.hasFragment()) { + holder.checkboxVisible.setVisibility(View.INVISIBLE); + } + // Hide enabled control and force enabled plugin if there is only one plugin available if (type == PluginBase.INSULIN || type == PluginBase.PUMP || type == PluginBase.TREATMENT || type == PluginBase.TEMPBASAL || type == PluginBase.PROFILE) if (pluginList.size() < 2) { @@ -292,7 +296,7 @@ public class ConfigBuilderFragment extends Fragment { } } - return convertView; + return view; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java index fa2df2e2ce..84135e5e85 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java @@ -127,6 +127,16 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain return false; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return false; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { // Always enabled @@ -174,7 +184,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain if (SP.contains(settingEnabled)) p.setFragmentEnabled(type, SP.getBoolean(settingEnabled, true)); if (SP.contains(settingVisible)) - p.setFragmentVisible(type, SP.getBoolean(settingVisible, true)); + p.setFragmentVisible(type, SP.getBoolean(settingVisible, true) && SP.getBoolean(settingEnabled, true)); } catch (Exception e) { e.printStackTrace(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java index 4ad1025315..b6f4e57acd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java @@ -76,6 +76,16 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java index b1fcf9d393..cdf7f554ee 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java @@ -57,6 +57,16 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface { return true; } + @Override + public boolean hasFragment() { + return false; + } + + @Override + public boolean showInList(int type) { + return false; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastacting/InsulinFastactingPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastacting/InsulinFastactingPlugin.java index d1c0d08184..9773c20f55 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastacting/InsulinFastactingPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastacting/InsulinFastactingPlugin.java @@ -55,6 +55,16 @@ public class InsulinFastactingPlugin implements PluginBase, InsulinInterface { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == INSULIN) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastactingProlonged/InsulinFastactingProlongedPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastactingProlonged/InsulinFastactingProlongedPlugin.java index 07dac771b8..58d644043c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastactingProlonged/InsulinFastactingProlongedPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastactingProlonged/InsulinFastactingProlongedPlugin.java @@ -17,7 +17,7 @@ import info.nightscout.androidaps.interfaces.ProfileInterface; public class InsulinFastactingProlongedPlugin implements PluginBase, InsulinInterface { - private static boolean fragmentEnabled = true; + private static boolean fragmentEnabled = false; private static boolean fragmentVisible = false; @Override @@ -55,6 +55,16 @@ public class InsulinFastactingProlongedPlugin implements PluginBase, InsulinInte return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == INSULIN) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java index af54ab8ced..bd0d22d88b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java @@ -88,6 +88,16 @@ public class IobCobCalculatorPlugin implements PluginBase { return false; } + @Override + public boolean hasFragment() { + return false; + } + + @Override + public boolean showInList(int type) { + return false; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java index 6a3869589b..f6d319dd7f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java @@ -44,7 +44,7 @@ public class LoopPlugin implements PluginBase { private static HandlerThread sHandlerThread; private boolean fragmentEnabled = false; - private boolean fragmentVisible = true; + private boolean fragmentVisible = false; private long loopSuspendedTill = 0L; // end of manual loop suspend private boolean isSuperBolus = false; @@ -113,6 +113,16 @@ public class LoopPlugin implements PluginBase { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == LOOP) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientInternalPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientInternalPlugin.java index 0099db7e5b..606858c5d9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientInternalPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientInternalPlugin.java @@ -109,6 +109,16 @@ public class NSClientInternalPlugin implements PluginBase { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == GENERAL) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java index be4257dd47..ee8caea6b4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java @@ -79,6 +79,16 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentVisible(int type, boolean fragmentVisible) { if (type == APS) this.fragmentVisible = fragmentVisible; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java index c4b8f3e34a..1e7bec7471 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java @@ -80,6 +80,16 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentVisible(int type, boolean fragmentVisible) { if (type == APS) this.fragmentVisible = fragmentVisible; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewPlugin.java index a8f0083afc..b513d68dac 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewPlugin.java @@ -70,6 +70,16 @@ public class OverviewPlugin implements PluginBase { return false; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return false; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { // Always enabled diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java index f36e490e28..6acd7a810c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java @@ -85,6 +85,16 @@ public class PersistentNotificationPlugin implements PluginBase{ return true; } + @Override + public boolean hasFragment() { + return false; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfilePlugin.java index 64b9a07c00..5a8813bdf8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfilePlugin.java @@ -29,7 +29,7 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte public static final String SETTINGS_PREFIX = "CircadianPercentageProfile"; private static Logger log = LoggerFactory.getLogger(CircadianPercentageProfilePlugin.class); - private static boolean fragmentEnabled = true; + private static boolean fragmentEnabled = false; private static boolean fragmentVisible = true; private static NSProfile convertedProfile = null; @@ -90,6 +90,16 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == PROFILE) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java index e05c846a2a..6e822e5d43 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java @@ -24,7 +24,7 @@ import info.nightscout.utils.SP; public class LocalProfilePlugin implements PluginBase, ProfileInterface { private static Logger log = LoggerFactory.getLogger(LocalProfilePlugin.class); - private static boolean fragmentEnabled = true; + private static boolean fragmentEnabled = false; private static boolean fragmentVisible = true; private static NSProfile convertedProfile = null; @@ -85,6 +85,16 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == PROFILE) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfilePlugin.java index 9144f29687..5f29881b2a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfilePlugin.java @@ -76,6 +76,16 @@ public class NSProfilePlugin implements PluginBase, ProfileInterface { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == PROFILE) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java index 7548bd277d..aac4a05798 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java @@ -24,7 +24,7 @@ import info.nightscout.utils.SP; public class SimpleProfilePlugin implements PluginBase, ProfileInterface { private static Logger log = LoggerFactory.getLogger(SimpleProfilePlugin.class); - private static boolean fragmentEnabled = true; + private static boolean fragmentEnabled = false; private static boolean fragmentVisible = true; private static NSProfile convertedProfile = null; @@ -83,6 +83,16 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == PROFILE) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java index 6191c15dc8..dd3fb86837 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java @@ -57,8 +57,8 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf return DanaRFragment.class.getName(); } - static boolean fragmentPumpEnabled = true; - static boolean fragmentProfileEnabled = true; + static boolean fragmentPumpEnabled = false; + static boolean fragmentProfileEnabled = false; static boolean fragmentPumpVisible = true; public static ExecutionService sExecutionService; @@ -186,6 +186,16 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return type == PUMP; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == PluginBase.PROFILE) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java index bd00947993..726e1b95ab 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java @@ -57,8 +57,8 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints return DanaRKoreanFragment.class.getName(); } - static boolean fragmentPumpEnabled = true; - static boolean fragmentProfileEnabled = true; + static boolean fragmentPumpEnabled = false; + static boolean fragmentProfileEnabled = false; static boolean fragmentPumpVisible = true; public static ExecutionService sExecutionService; @@ -188,6 +188,16 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return type == PUMP; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == PluginBase.PROFILE) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java index c2ddc47981..e9010438c6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java @@ -92,6 +92,16 @@ public class MDIPlugin implements PluginBase, PumpInterface { return true; } + @Override + public boolean hasFragment() { + return false; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == PUMP) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java index e278400026..2a1221e88d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java @@ -110,6 +110,16 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == PUMP) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java index 9f0df0a635..6e9d555268 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java @@ -151,6 +151,16 @@ public class SmsCommunicatorPlugin implements PluginBase { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == GENERAL) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SourceGlimp/SourceGlimpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SourceGlimp/SourceGlimpPlugin.java index 7a5965e3df..3c1248c4de 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SourceGlimp/SourceGlimpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SourceGlimp/SourceGlimpPlugin.java @@ -48,6 +48,16 @@ public class SourceGlimpPlugin implements PluginBase, BgSourceInterface { return true; } + @Override + public boolean hasFragment() { + return false; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SourceMM640g/SourceMM640gPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SourceMM640g/SourceMM640gPlugin.java index b1d7a52cd0..df8111b5cd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SourceMM640g/SourceMM640gPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SourceMM640g/SourceMM640gPlugin.java @@ -10,7 +10,7 @@ import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientFragment; * Created by mike on 05.08.2016. */ public class SourceMM640gPlugin implements PluginBase, BgSourceInterface { - boolean fragmentEnabled = true; + boolean fragmentEnabled = false; @Override public String getFragmentClass() { @@ -48,6 +48,16 @@ public class SourceMM640gPlugin implements PluginBase, BgSourceInterface { return true; } + @Override + public boolean hasFragment() { + return false; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SourceNSClient/SourceNSClientPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SourceNSClient/SourceNSClientPlugin.java index 7e38e6dc47..db11ab4ea5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SourceNSClient/SourceNSClientPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SourceNSClient/SourceNSClientPlugin.java @@ -48,6 +48,16 @@ public class SourceNSClientPlugin implements PluginBase, BgSourceInterface { return true; } + @Override + public boolean hasFragment() { + return false; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SourceXdrip/SourceXdripPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SourceXdrip/SourceXdripPlugin.java index a1a4f01b86..b32040a2e8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SourceXdrip/SourceXdripPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SourceXdrip/SourceXdripPlugin.java @@ -16,7 +16,7 @@ public class SourceXdripPlugin implements PluginBase, BgSourceInterface { return SourceNSClientFragment.class.getName(); } - private static boolean fragmentEnabled = true; + private static boolean fragmentEnabled = false; @Override public int getType() { @@ -49,6 +49,16 @@ public class SourceXdripPlugin implements PluginBase, BgSourceInterface { return true; } + @Override + public boolean hasFragment() { + return false; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsPlugin.java index 98ca25513b..d398ddfad6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsPlugin.java @@ -87,6 +87,16 @@ public class TempBasalsPlugin implements PluginBase, TempBasalsInterface { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == TEMPBASAL) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/TempTargetRange/TempTargetRangePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/TempTargetRange/TempTargetRangePlugin.java index 08a09aa644..63592f7878 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/TempTargetRange/TempTargetRangePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/TempTargetRange/TempTargetRangePlugin.java @@ -19,7 +19,7 @@ import info.nightscout.androidaps.plugins.TempTargetRange.events.EventTempTarget public class TempTargetRangePlugin implements PluginBase { - static boolean fragmentEnabled = true; + static boolean fragmentEnabled = false; static boolean fragmentVisible = true; private static List tempTargets; @@ -70,6 +70,16 @@ public class TempTargetRangePlugin implements PluginBase { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == GENERAL) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java index 189b8d3bc6..d0ba64f124 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java @@ -76,6 +76,16 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == TREATMENT) this.fragmentEnabled = fragmentEnabled; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/WearPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/WearPlugin.java index 0884cdf55e..9508908c84 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/WearPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/WearPlugin.java @@ -5,6 +5,7 @@ import android.content.Intent; import com.squareup.otto.Subscribe; +import info.nightscout.androidaps.Config; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventBolusRequested; @@ -28,7 +29,7 @@ import info.nightscout.utils.ToastUtils; public class WearPlugin implements PluginBase { - static boolean fragmentEnabled = true; + static boolean fragmentEnabled = Config.WEAR; static boolean fragmentVisible = true; private static WatchUpdaterService watchUS; private final Context ctx; @@ -79,6 +80,16 @@ public class WearPlugin implements PluginBase { return true; } + @Override + public boolean hasFragment() { + return true; + } + + @Override + public boolean showInList(int type) { + return true; + } + @Override public void setFragmentEnabled(int type, boolean fragmentEnabled) { if (type == GENERAL) {