From 549b72b0326f2e6d4526cfa7e32da54d1bb23a51 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Tue, 10 Oct 2017 21:51:58 +0200 Subject: [PATCH] fix percentage/shift from watch --- .../plugins/Careportal/Dialogs/NewNSTreatmentDialog.java | 4 ++-- .../androidaps/plugins/Wear/ActionStringHandler.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java index 2477b0019b..bb727966f6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java @@ -322,7 +322,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick editCarbTime.setParams(0d, -60d, 60d, 5d, new DecimalFormat("0"), false); editPercentage = (NumberPicker) view.findViewById(R.id.careportal_newnstreatment_percentage); - editPercentage.setParams(100d, (double) Constants.CPP_MIN_PERCENTAGE, (double) Constants.CPP_MAX_PERCENTAGE, 5d, new DecimalFormat("0"), false); + editPercentage.setParams(100d, (double) Constants.CPP_MIN_PERCENTAGE, (double) Constants.CPP_MAX_PERCENTAGE, 1d, new DecimalFormat("0"), false); editTimeshift = (NumberPicker) view.findViewById(R.id.careportal_newnstreatment_timeshift); editTimeshift.setParams(0d, (double) Constants.CPP_MIN_TIMESHIFT, (double) Constants.CPP_MAX_TIMESHIFT, 1d, new DecimalFormat("0"), false); @@ -722,7 +722,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick @Override public void run() { ProfileSwitch profileSwitch = MainApp.getConfigBuilder().getProfileSwitchFromHistory(System.currentTimeMillis()); - if (profileSwitch == null) { + if (profileSwitch != null) { profileSwitch = new ProfileSwitch(); profileSwitch.date = System.currentTimeMillis(); profileSwitch.source = Source.USER; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index 45c57e8b99..7d7928cbf4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -565,7 +565,7 @@ public class ActionStringHandler { } else if ("cppset".equals(act[0])) { int timeshift = SafeParse.stringToInt(act[1]); int percentage = SafeParse.stringToInt(act[2]); - setCPP(percentage, timeshift); + setCPP(timeshift, percentage); } else if ("dismissoverviewnotification".equals(act[0])){ MainApp.bus().post(new EventDismissNotification(SafeParse.stringToInt(act[1]))); } @@ -576,6 +576,7 @@ public class ActionStringHandler { String msg = ""; + //check for validity if (percentage < Constants.CPP_MIN_PERCENTAGE || percentage > Constants.CPP_MAX_PERCENTAGE) { msg+= String.format(MainApp.sResources.getString(R.string.openapsma_valueoutofrange), "Profile-Percentage") + "\n";