configbuilder UI improvement

This commit is contained in:
Milos Kozak 2017-04-29 16:59:44 +02:00
parent 686d6635d3
commit 66d011665d
34 changed files with 385 additions and 38 deletions

View file

@ -204,6 +204,21 @@ public class MainApp extends Application {
return newList;
}
public static ArrayList<PluginBase> getSpecificPluginsVisibleInList(int type) {
ArrayList<PluginBase> 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<PluginBase> getSpecificPluginsListByInterface(Class interfaceClass) {
ArrayList<PluginBase> newList = new ArrayList<>();
@ -218,6 +233,21 @@ public class MainApp extends Application {
return newList;
}
public static ArrayList<PluginBase> getSpecificPluginsVisibleInListByInterface(Class interfaceClass, int type) {
ArrayList<PluginBase> 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) {

View file

@ -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);
}

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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();
}

View file

@ -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) {
}

View file

@ -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) {

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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) {

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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)

View file

@ -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)

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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<TempTarget> 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) {

View file

@ -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;

View file

@ -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) {