diff --git a/app/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java b/app/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java index 5c865a331c..1632751d55 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java +++ b/app/src/main/java/info/nightscout/androidaps/db/ExtendedBolus.java @@ -325,8 +325,8 @@ public class ExtendedBolus implements Interval, DataPointWithLabelInterface { } public String toStringMedium() { - return "E " + DecimalFormatter.to2Decimal(absoluteRate()) + "U/h (" - + getRealDuration() + "/" + durationInMinutes + ") "; + return DecimalFormatter.to2Decimal(absoluteRate()) + "U/h " + + getRealDuration() + "/" + durationInMinutes + "'"; } public String toStringTotal() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java index 4d66f36194..695d672cec 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java @@ -21,6 +21,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin; +import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.HardLimits; import info.nightscout.androidaps.utils.Round; @@ -74,6 +75,9 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface { value.set(false, MainApp.gs(R.string.closed_loop_disabled_on_dev_branch), this); } + if (TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress()) { + value.set(false, MainApp.gs(R.string.closed_loop_disabled_with_eb), this); + } return value; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt index 8d8fbd256b..4977cd6f9f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt @@ -29,11 +29,7 @@ import info.nightscout.androidaps.dialogs.ProfileSwitchDialog import info.nightscout.androidaps.dialogs.TempTargetDialog import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.queue.Callback -import info.nightscout.androidaps.utils.FabricPrivacy -import info.nightscout.androidaps.utils.SP -import info.nightscout.androidaps.utils.SingleClickButton -import info.nightscout.androidaps.utils.plusAssign -import info.nightscout.androidaps.utils.toVisibility +import info.nightscout.androidaps.utils.* import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.disposables.CompositeDisposable import kotlinx.android.synthetic.main.actions_fragment.* @@ -62,7 +58,12 @@ class ActionsFragment : Fragment() { fragmentManager?.let { TempTargetDialog().show(it, "Actions") } } actions_extendedbolus.setOnClickListener { - fragmentManager?.let { ExtendedBolusDialog().show(it, "Actions") } + context?.let { context -> + OKDialog.showConfirmation(context, MainApp.gs(R.string.extended_bolus), MainApp.gs(R.string.ebstopsloop), + Runnable { + fragmentManager?.let { ExtendedBolusDialog().show(it, "Actions") } + }, null) + } } actions_extendedbolus_cancel.setOnClickListener { if (TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress) { @@ -178,7 +179,7 @@ class ActionsFragment : Fragment() { actions_profileswitch?.visibility = if (!basalProfileEnabled || !pump.isInitialized || pump.isSuspended) View.GONE else View.VISIBLE - if (!pump.pumpDescription.isExtendedBolusCapable || !pump.isInitialized || pump.isSuspended || pump.isFakingTempsByExtendedBoluses || Config.APS) { + if (!pump.pumpDescription.isExtendedBolusCapable || !pump.isInitialized || pump.isSuspended || pump.isFakingTempsByExtendedBoluses) { actions_extendedbolus?.visibility = View.GONE actions_extendedbolus_cancel?.visibility = View.GONE } else { @@ -186,7 +187,7 @@ class ActionsFragment : Fragment() { if (activeExtendedBolus != null) { actions_extendedbolus?.visibility = View.GONE actions_extendedbolus_cancel?.visibility = View.VISIBLE - actions_extendedbolus_cancel?.text = MainApp.gs(R.string.cancel) + " " + activeExtendedBolus.toString() + actions_extendedbolus_cancel?.text = MainApp.gs(R.string.cancel) + " " + activeExtendedBolus.toStringMedium() } else { actions_extendedbolus?.visibility = View.VISIBLE actions_extendedbolus_cancel?.visibility = View.GONE diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java index bc14b6b827..2a246c596c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java @@ -137,6 +137,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, TextView avgdeltaView; TextView baseBasalView; TextView extendedBolusView; + LinearLayout extendedBolusLayout; TextView activeProfileView; TextView iobView; TextView cobView; @@ -240,6 +241,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, avgdeltaView = (TextView) view.findViewById(R.id.overview_avgdelta); baseBasalView = (TextView) view.findViewById(R.id.overview_basebasal); extendedBolusView = (TextView) view.findViewById(R.id.overview_extendedbolus); + extendedBolusLayout = view.findViewById(R.id.overview_extendedbolus_layout); activeProfileView = (TextView) view.findViewById(R.id.overview_activeprofile); pumpStatusView = (TextView) view.findViewById(R.id.overview_pumpstatus); pumpDeviceStatusView = (TextView) view.findViewById(R.id.overview_pump); @@ -1187,15 +1189,18 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, } } else { if (extendedBolus != null && !pump.isFakingTempsByExtendedBoluses()) { - extendedBolusText = extendedBolus.toString(); + extendedBolusText = extendedBolus.toStringMedium(); } } extendedBolusView.setText(extendedBolusText); extendedBolusView.setOnClickListener(v -> OKDialog.show(getActivity(), MainApp.gs(R.string.extended_bolus), extendedBolus.toString())); - if (extendedBolusText.equals("")) - extendedBolusView.setVisibility(Config.NSCLIENT ? View.INVISIBLE : View.GONE); - else + if (extendedBolusText.equals("")) { + extendedBolusLayout.setVisibility(View.GONE); + if (extendedBolusLayout != null) extendedBolusView.setVisibility(Config.NSCLIENT ? View.INVISIBLE : View.GONE); + } else { extendedBolusView.setVisibility(View.VISIBLE); + if (extendedBolusLayout != null) extendedBolusLayout.setVisibility(View.VISIBLE); + } } activeProfileView.setText(ProfileFunctions.getInstance().getProfileNameWithDuration()); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt index 87f7d832da..05a78bfb67 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt @@ -9,6 +9,7 @@ import android.telephony.SmsManager import android.telephony.SmsMessage import android.text.TextUtils import com.andreabaccega.widget.ValidatingEditTextPreference +import info.nightscout.androidaps.Config import info.nightscout.androidaps.Constants import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.R @@ -597,6 +598,7 @@ object SmsCommunicatorPlugin : PluginBase(PluginDescription() override fun run() { if (result.success) { var replyText = String.format(MainApp.gs(R.string.smscommunicator_extendedset), aDouble, duration) + if (Config.APS) replyText += "\n" + MainApp.gs(R.string.loopsuspended) replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true) sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText)) } else { diff --git a/app/src/main/res/layout/overview_fragment.xml b/app/src/main/res/layout/overview_fragment.xml index 882f752e1a..eb25059db2 100644 --- a/app/src/main/res/layout/overview_fragment.xml +++ b/app/src/main/res/layout/overview_fragment.xml @@ -270,6 +270,37 @@ android:textStyle="bold"/> + + + + + + + + + + - - + + + + + + + + + - - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f34ec9c784..4de153a543 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1687,5 +1687,8 @@ Already set Message Clear queue? All data in queue will be lost! + Use of Extended bolus feature will stop closed loop mode for the time of running extended bolus. Do you really want it? + Closed loop disabled because of running Extended bolus + EB