Merge pull request #1543 from triplem/suspend_with_loop_disabled
Allow disconnection/suspend of pump even while Loop is deactivated
This commit is contained in:
commit
6e1a01e9d3
|
@ -446,7 +446,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
if (v == apsModeView) {
|
if (v == apsModeView) {
|
||||||
final LoopPlugin loopPlugin = LoopPlugin.getPlugin();
|
final LoopPlugin loopPlugin = LoopPlugin.getPlugin();
|
||||||
final PumpDescription pumpDescription = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription();
|
final PumpDescription pumpDescription =
|
||||||
|
ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription();
|
||||||
if (!ProfileFunctions.getInstance().isProfileValid("ContexMenuCreation"))
|
if (!ProfileFunctions.getInstance().isProfileValid("ContexMenuCreation"))
|
||||||
return;
|
return;
|
||||||
menu.setHeaderTitle(MainApp.gs(R.string.loop));
|
menu.setHeaderTitle(MainApp.gs(R.string.loop));
|
||||||
|
@ -457,19 +458,21 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
menu.add(MainApp.gs(R.string.suspendloopfor2h));
|
menu.add(MainApp.gs(R.string.suspendloopfor2h));
|
||||||
menu.add(MainApp.gs(R.string.suspendloopfor3h));
|
menu.add(MainApp.gs(R.string.suspendloopfor3h));
|
||||||
menu.add(MainApp.gs(R.string.suspendloopfor10h));
|
menu.add(MainApp.gs(R.string.suspendloopfor10h));
|
||||||
if (pumpDescription.tempDurationStep15mAllowed)
|
} else {
|
||||||
menu.add(MainApp.gs(R.string.disconnectpumpfor15m));
|
|
||||||
if (pumpDescription.tempDurationStep30mAllowed)
|
|
||||||
menu.add(MainApp.gs(R.string.disconnectpumpfor30m));
|
|
||||||
menu.add(MainApp.gs(R.string.disconnectpumpfor1h));
|
|
||||||
menu.add(MainApp.gs(R.string.disconnectpumpfor2h));
|
|
||||||
menu.add(MainApp.gs(R.string.disconnectpumpfor3h));
|
|
||||||
} else {
|
|
||||||
menu.add(MainApp.gs(R.string.resume));
|
menu.add(MainApp.gs(R.string.resume));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!loopPlugin.isEnabled(PluginType.LOOP))
|
|
||||||
|
if (!loopPlugin.isEnabled(PluginType.LOOP)) {
|
||||||
menu.add(MainApp.gs(R.string.enableloop));
|
menu.add(MainApp.gs(R.string.enableloop));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!loopPlugin.isDisconnected()) {
|
||||||
|
showSuspendtPump(menu, pumpDescription);
|
||||||
|
} else {
|
||||||
|
menu.add(MainApp.gs(R.string.reconnect));
|
||||||
|
}
|
||||||
|
|
||||||
} else if (v == activeProfileView) {
|
} else if (v == activeProfileView) {
|
||||||
menu.setHeaderTitle(MainApp.gs(R.string.profile));
|
menu.setHeaderTitle(MainApp.gs(R.string.profile));
|
||||||
menu.add(MainApp.gs(R.string.danar_viewprofile));
|
menu.add(MainApp.gs(R.string.danar_viewprofile));
|
||||||
|
@ -488,6 +491,17 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showSuspendtPump(ContextMenu menu,
|
||||||
|
PumpDescription pumpDescription) {
|
||||||
|
if (pumpDescription.tempDurationStep15mAllowed)
|
||||||
|
menu.add(MainApp.gs(R.string.disconnectpumpfor15m));
|
||||||
|
if (pumpDescription.tempDurationStep30mAllowed)
|
||||||
|
menu.add(MainApp.gs(R.string.disconnectpumpfor30m));
|
||||||
|
menu.add(MainApp.gs(R.string.disconnectpumpfor1h));
|
||||||
|
menu.add(MainApp.gs(R.string.disconnectpumpfor2h));
|
||||||
|
menu.add(MainApp.gs(R.string.disconnectpumpfor3h));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextItemSelected(MenuItem item) {
|
public boolean onContextItemSelected(MenuItem item) {
|
||||||
final Profile profile = ProfileFunctions.getInstance().getProfile();
|
final Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
|
@ -516,7 +530,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
updateGUI("suspendmenu");
|
updateGUI("suspendmenu");
|
||||||
NSUpload.uploadOpenAPSOffline(0);
|
NSUpload.uploadOpenAPSOffline(0);
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getTitle().equals(MainApp.gs(R.string.resume))) {
|
} else if (item.getTitle().equals(MainApp.gs(R.string.resume)) ||
|
||||||
|
item.getTitle().equals(MainApp.gs(R.string.reconnect))) {
|
||||||
loopPlugin.suspendTo(0L);
|
loopPlugin.suspendTo(0L);
|
||||||
updateGUI("suspendmenu");
|
updateGUI("suspendmenu");
|
||||||
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() {
|
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() {
|
||||||
|
@ -1095,7 +1110,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
apsModeView.setBackgroundColor(MainApp.gc(R.color.looppumpsuspended));
|
apsModeView.setBackgroundColor(MainApp.gc(R.color.looppumpsuspended));
|
||||||
apsModeView.setText(String.format(MainApp.gs(R.string.loopsuperbolusfor), loopPlugin.minutesToEndOfSuspend()));
|
apsModeView.setText(String.format(MainApp.gs(R.string.loopsuperbolusfor), loopPlugin.minutesToEndOfSuspend()));
|
||||||
apsModeView.setTextColor(Color.WHITE);
|
apsModeView.setTextColor(Color.WHITE);
|
||||||
} else if (loopPlugin.isEnabled(PluginType.LOOP) && loopPlugin.isDisconnected()) {
|
} else if (loopPlugin.isDisconnected()) {
|
||||||
apsModeView.setBackgroundColor(MainApp.gc(R.color.looppumpsuspended));
|
apsModeView.setBackgroundColor(MainApp.gc(R.color.looppumpsuspended));
|
||||||
apsModeView.setText(String.format(MainApp.gs(R.string.loopdisconnectedfor), loopPlugin.minutesToEndOfSuspend()));
|
apsModeView.setText(String.format(MainApp.gs(R.string.loopdisconnectedfor), loopPlugin.minutesToEndOfSuspend()));
|
||||||
apsModeView.setTextColor(Color.WHITE);
|
apsModeView.setTextColor(Color.WHITE);
|
||||||
|
|
|
@ -584,6 +584,7 @@
|
||||||
<string name="disconnectpumpfor2h">Disconnect pump for 2 h</string>
|
<string name="disconnectpumpfor2h">Disconnect pump for 2 h</string>
|
||||||
<string name="disconnectpumpfor3h">Disconnect pump for 3 h</string>
|
<string name="disconnectpumpfor3h">Disconnect pump for 3 h</string>
|
||||||
<string name="resume">Resume</string>
|
<string name="resume">Resume</string>
|
||||||
|
<string name="reconnect">Reconnect Pump</string>
|
||||||
<string name="smscommunicator_wrongduration">Wrong duration</string>
|
<string name="smscommunicator_wrongduration">Wrong duration</string>
|
||||||
<string name="smscommunicator_loopsuspended">Loop suspended</string>
|
<string name="smscommunicator_loopsuspended">Loop suspended</string>
|
||||||
<string name="smscommunicator_loopresumed">Loop resumed</string>
|
<string name="smscommunicator_loopresumed">Loop resumed</string>
|
||||||
|
|
Loading…
Reference in a new issue