From b3d18b2537cc024a43d08f9cbcdabb782734f93f Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 30 May 2017 18:23:07 +0200 Subject: [PATCH] disable bolus when pump is suspended --- .../androidaps/plugins/Overview/OverviewFragment.java | 11 +++++++++-- .../SmsCommunicator/SmsCommunicatorPlugin.java | 3 +++ .../main/res/layout/overview_newtempbasal_dialog.xml | 1 - 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index b050202a53..637bf018d8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -804,8 +804,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, pumpStatusLayout.setVisibility(View.VISIBLE); loopStatusLayout.setVisibility(View.GONE); } else { - wizardButton.setVisibility(View.VISIBLE); - treatmentButton.setVisibility(View.VISIBLE); pumpStatusLayout.setVisibility(View.GONE); loopStatusLayout.setVisibility(View.VISIBLE); } @@ -1002,6 +1000,15 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, } else quickWizardButton.setVisibility(View.GONE); + // Bolus and calc button + if (pump.isInitialized() && !pump.isSuspended()) { + wizardButton.setVisibility(View.VISIBLE); + treatmentButton.setVisibility(View.VISIBLE); + } else { + wizardButton.setVisibility(View.GONE); + treatmentButton.setVisibility(View.GONE); + } + String units = profile.getUnits(); Double lowLine = SP.getDouble("low_mark", 0d); 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 344b9aaf00..ecacbbcb48 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 @@ -425,6 +425,9 @@ public class SmsCommunicatorPlugin implements PluginBase { if (new Date().getTime() - lastRemoteBolusTime.getTime() < Constants.remoteBolusMinDistance) { reply = MainApp.sResources.getString(R.string.smscommunicator_remotebolusnotallowed); sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date())); + } else if (MainApp.getConfigBuilder().isSuspended()) { + reply = MainApp.sResources.getString(R.string.pumpsuspended); + sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date())); } else if (splited.length > 1) { amount = SafeParse.stringToDouble(splited[1]); amount = MainApp.getConfigBuilder().applyBolusConstraints(amount); diff --git a/app/src/main/res/layout/overview_newtempbasal_dialog.xml b/app/src/main/res/layout/overview_newtempbasal_dialog.xml index f4b8d90731..04caae43f4 100644 --- a/app/src/main/res/layout/overview_newtempbasal_dialog.xml +++ b/app/src/main/res/layout/overview_newtempbasal_dialog.xml @@ -197,7 +197,6 @@ android:layout_width="fill_parent" android:layout_height="2dip" android:layout_alignParentBottom="true" - android:layout_paddingBottom="5dp" android:layout_marginBottom="5dp" android:layout_marginLeft="5dp" android:layout_marginRight="5dp"