Merge branch 'dev' into history
This commit is contained in:
commit
7bed883368
|
@ -357,6 +357,15 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
activeloop.setFragmentVisible(PluginBase.LOOP, false);
|
||||
MainApp.getConfigBuilder().storeSettings();
|
||||
scheduleUpdateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
if (!result.success) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
}
|
||||
}
|
||||
});
|
||||
ConfigBuilderPlugin.uploadOpenAPSOffline(60); // upload 60 min, we don;t know real duration
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.enableloop))) {
|
||||
|
@ -383,21 +392,57 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor1h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 60L * 60 * 1000);
|
||||
scheduleUpdateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
if (!result.success) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
}
|
||||
}
|
||||
});
|
||||
ConfigBuilderPlugin.uploadOpenAPSOffline(60);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor2h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 2 * 60L * 60 * 1000);
|
||||
scheduleUpdateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
if (!result.success) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
}
|
||||
}
|
||||
});
|
||||
ConfigBuilderPlugin.uploadOpenAPSOffline(120);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor3h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 3 * 60L * 60 * 1000);
|
||||
scheduleUpdateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
if (!result.success) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
}
|
||||
}
|
||||
});
|
||||
ConfigBuilderPlugin.uploadOpenAPSOffline(180);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor10h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 10 * 60L * 60 * 1000);
|
||||
scheduleUpdateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
if (!result.success) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
}
|
||||
}
|
||||
});
|
||||
ConfigBuilderPlugin.uploadOpenAPSOffline(600);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor30m))) {
|
||||
|
|
|
@ -276,7 +276,10 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
LoopPlugin loopPlugin = (LoopPlugin) MainApp.getSpecificPlugin(LoopPlugin.class);
|
||||
if (loopPlugin != null && loopPlugin.isEnabled(PluginBase.LOOP)) {
|
||||
loopPlugin.setFragmentEnabled(PluginBase.LOOP, false);
|
||||
reply = MainApp.sResources.getString(R.string.smscommunicator_loophasbeendisabled);
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
MainApp.bus().post(new EventRefreshGui(false));
|
||||
reply = MainApp.sResources.getString(R.string.smscommunicator_loophasbeendisabled)+ " " +
|
||||
MainApp.sResources.getString(result.success?R.string.smscommunicator_tempbasalcanceled:R.string.smscommunicator_tempbasalcancelfailed);
|
||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
}
|
||||
receivedSms.processed = true;
|
||||
|
@ -529,9 +532,11 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
suspendWaitingForConfirmation.processed = true;
|
||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||
activeloop.suspendTo(new Date().getTime() + suspendWaitingForConfirmation.duration * 60L * 1000);
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
ConfigBuilderPlugin.uploadOpenAPSOffline(suspendWaitingForConfirmation.duration * 60);
|
||||
MainApp.bus().post(new EventRefreshGui(false));
|
||||
reply = MainApp.sResources.getString(R.string.smscommunicator_loopsuspended);
|
||||
reply = MainApp.sResources.getString(R.string.smscommunicator_loopsuspended) + " " +
|
||||
MainApp.sResources.getString(result.success?R.string.smscommunicator_tempbasalcanceled:R.string.smscommunicator_tempbasalcancelfailed);
|
||||
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
} else {
|
||||
sendSMS(new Sms(receivedSms.phoneNumber, MainApp.sResources.getString(R.string.smscommunicator_unknowncommand), new Date()));
|
||||
|
|
Loading…
Reference in a new issue