Merge pull request #332 from AdrianLxM/cancel-userRequesed-flag

remove translated string not in default strings and add flag to cance…
This commit is contained in:
Milos Kozak 2017-08-03 08:08:45 +02:00 committed by GitHub
commit b5cfe1c727
11 changed files with 28 additions and 27 deletions

View file

@ -34,7 +34,9 @@ public interface PumpInterface {
PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes);
PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes);
PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes);
PumpEnactResult cancelTempBasal();
//some pumps might set a very short temp close to 100% as canecelling a temp can be noisy
//when the cancel request is requested by the user, the pump should always do a real cancel
PumpEnactResult cancelTempBasal(boolean userRequested);
PumpEnactResult cancelExtendedBolus();
// Status to be passed to NS

View file

@ -509,8 +509,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
}
@Override
public PumpEnactResult cancelTempBasal() {
PumpEnactResult result = activePump.cancelTempBasal();
public PumpEnactResult cancelTempBasal(boolean userRequested) {
PumpEnactResult result = activePump.cancelTempBasal(userRequested);
if (Config.logCongigBuilderActions)
log.debug("cancelTempBasal success: " + result.success + " enacted: " + result.enacted);
return result;
@ -559,7 +559,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
if (isTempBasalInProgress()) {
if (Config.logCongigBuilderActions)
log.debug("applyAPSRequest: cancelTempBasal()");
result = cancelTempBasal();
result = cancelTempBasal(false);
} else {
result = new PumpEnactResult();
result.absolute = request.rate;

View file

@ -313,7 +313,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
activeloop.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
MainApp.bus().post(new EventRefreshOverview("WizardDialog"));
}
pump.cancelTempBasal();
pump.cancelTempBasal(true);
result = pump.setTempBasalAbsolute(0d, 120);
if (!result.success) {
OKDialog.show(getActivity(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror), result.comment, null);

View file

@ -411,7 +411,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
@ -432,7 +432,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
@ -446,7 +446,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
@ -460,7 +460,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
@ -474,7 +474,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
@ -488,7 +488,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
@ -502,7 +502,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().cancelTempBasal();
MainApp.getConfigBuilder().cancelTempBasal(true);
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 30);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
@ -517,7 +517,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().cancelTempBasal();
MainApp.getConfigBuilder().cancelTempBasal(true);
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 60);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
@ -532,7 +532,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().cancelTempBasal();
MainApp.getConfigBuilder().cancelTempBasal(true);
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 2 * 60);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
@ -547,7 +547,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().cancelTempBasal();
MainApp.getConfigBuilder().cancelTempBasal(true);
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 3 * 60);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
@ -589,7 +589,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
pump.cancelTempBasal();
pump.cancelTempBasal(true);
Answers.getInstance().logCustom(new CustomEvent("CancelTemp"));
}
});

View file

@ -566,7 +566,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
}
@Override
public PumpEnactResult cancelTempBasal() {
public PumpEnactResult cancelTempBasal(boolean userRequested) {
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress())
return cancelRealTempBasal();
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) {

View file

@ -570,7 +570,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
}
@Override
public PumpEnactResult cancelTempBasal() {
public PumpEnactResult cancelTempBasal(boolean userRequested) {
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress())
return cancelRealTempBasal();
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) {

View file

@ -340,7 +340,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
if (Config.logPumpActions)
log.debug("setTempBasalAbsolute: Stopping temp basal (doTempOff)");
return cancelTempBasal();
return cancelTempBasal(false);
}
result.success = true;
result.enacted = false;
@ -507,7 +507,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
}
@Override
public PumpEnactResult cancelTempBasal() {
public PumpEnactResult cancelTempBasal(boolean userRequested) {
PumpEnactResult result = new PumpEnactResult();
if (pump.isTempBasalInProgress) {
sExecutionService.tempBasalStop();

View file

@ -196,7 +196,7 @@ public class MDIPlugin implements PluginBase, PumpInterface {
}
@Override
public PumpEnactResult cancelTempBasal() {
public PumpEnactResult cancelTempBasal(boolean userRequested) {
PumpEnactResult result = new PumpEnactResult();
result.success = false;
result.comment = MainApp.instance().getString(R.string.pumperror);

View file

@ -286,7 +286,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
PumpEnactResult result = new PumpEnactResult();
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
result = cancelTempBasal();
result = cancelTempBasal(false);
if (!result.success)
return result;
}
@ -337,7 +337,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
}
@Override
public PumpEnactResult cancelTempBasal() {
public PumpEnactResult cancelTempBasal(boolean userRequested) {
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
PumpEnactResult result = new PumpEnactResult();
result.success = true;

View file

@ -272,7 +272,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
LoopPlugin loopPlugin = (LoopPlugin) MainApp.getSpecificPlugin(LoopPlugin.class);
if (loopPlugin != null && loopPlugin.isEnabled(PluginBase.LOOP)) {
loopPlugin.setFragmentEnabled(PluginBase.LOOP, false);
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
MainApp.bus().post(new EventRefreshOverview("SMS_LOOP_STOP"));
reply = MainApp.sResources.getString(R.string.smscommunicator_loophasbeendisabled)+ " " +
MainApp.sResources.getString(result.success?R.string.smscommunicator_tempbasalcanceled:R.string.smscommunicator_tempbasalcancelfailed);
@ -506,7 +506,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
PumpInterface pumpInterface = MainApp.getConfigBuilder();
if (pumpInterface != null) {
danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class);
PumpEnactResult result = pumpInterface.cancelTempBasal();
PumpEnactResult result = pumpInterface.cancelTempBasal(true);
if (result.success) {
reply = MainApp.sResources.getString(R.string.smscommunicator_tempbasalcanceled);
if (danaRPlugin != null)
@ -535,7 +535,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
suspendWaitingForConfirmation.processed = true;
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
activeloop.suspendTo(System.currentTimeMillis() + suspendWaitingForConfirmation.duration * 60L * 1000);
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
NSUpload.uploadOpenAPSOffline(suspendWaitingForConfirmation.duration * 60);
MainApp.bus().post(new EventRefreshOverview("SMS_LOOP_SUSPENDED"));
reply = MainApp.sResources.getString(R.string.smscommunicator_loopsuspended) + " " +

View file

@ -632,7 +632,6 @@
<string name="ns_localbroadcasts">Разреши предаване към други приложения (напр. xDrip)</string>
<string name="ns_localbroadcasts_title">Разреши локално предаване на данни</string>
<string name="objectives_0_gate">Потвърждаване, че КЗ е достъпна в Найтскаут и данните за помпата се качват там</string>
<string name="overview_newtempbasal_basal_label">Базална стойност</string>
<string name="wear_detailedIOB_summary">Раздели IOB от болус и от базал на часовника</string>
<string name="wear_detailedIOB_title">Покажи подробен IOB</string>
<string name="app_name">AndroidAPS</string>