From 4c21fe83834214144c36168eb81ac3c68820b252 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 11 Jul 2016 18:42:14 +0200 Subject: [PATCH] formating fix --- .../nightscout/androidaps/db/BgReading.java | 2 +- .../ConfigBuilder/ConfigBuilderFragment.java | 28 ++++++++----------- .../plugins/DanaR/DanaRFragment.java | 1 + 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/db/BgReading.java b/app/src/main/java/info/nightscout/androidaps/db/BgReading.java index 04938d865e..4c78bd9c58 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/BgReading.java +++ b/app/src/main/java/info/nightscout/androidaps/db/BgReading.java @@ -59,7 +59,7 @@ public class BgReading implements DataPointInterface { public String valueToUnitsToString(String units) { if (units.equals(Constants.MGDL)) return DecimalFormatter.to0Decimal(value); - else return DecimalFormatter.to0Decimal(value * Constants.MGDL_TO_MMOLL); + else return DecimalFormatter.to1Decimal(value * Constants.MGDL_TO_MMOLL); } @Override diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java index c73ae114ed..17a192c56f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java @@ -159,7 +159,8 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI loopDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainActivity.getSpecificPluginsList(PluginBase.LOOP), PluginBase.LOOP); loopListView.setAdapter(loopDataAdapter); setListViewHeightBasedOnChildren(loopListView); - if (MainActivity.getSpecificPluginsList(PluginBase.LOOP).size() == 0) loopLabel.setVisibility(View.GONE); + if (MainActivity.getSpecificPluginsList(PluginBase.LOOP).size() == 0) + loopLabel.setVisibility(View.GONE); treatmentsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainActivity.getSpecificPluginsList(PluginBase.TREATMENT), PluginBase.TREATMENT); treatmentsListView.setAdapter(treatmentsDataAdapter); setListViewHeightBasedOnChildren(treatmentsListView); @@ -172,7 +173,8 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI apsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainActivity.getSpecificPluginsList(PluginBase.APS), PluginBase.APS); apsListView.setAdapter(apsDataAdapter); setListViewHeightBasedOnChildren(apsListView); - if (MainActivity.getSpecificPluginsList(PluginBase.APS).size() == 0) apsLabel.setVisibility(View.GONE); + if (MainActivity.getSpecificPluginsList(PluginBase.APS).size() == 0) + apsLabel.setVisibility(View.GONE); constraintsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainActivity.getSpecificPluginsListByInterface(ConstraintsInterface.class), PluginBase.CONSTRAINTS); constraintsListView.setAdapter(constraintsDataAdapter); setListViewHeightBasedOnChildren(constraintsListView); @@ -307,7 +309,11 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI Double rateAfterConstraints = applyBasalConstraints(absoluteRate); PumpEnactResult result = activePump.setTempBasalAbsolute(rateAfterConstraints, durationInMinutes); if (result.enacted && result.success) { - uploadTempBasalStartAbsolute(result.absolute, result.duration); + if (result.isPercent) { + uploadTempBasalStartPercent(result.percent, result.duration); + } else { + uploadTempBasalStartAbsolute(result.absolute, result.duration); + } MainApp.bus().post(new EventTempBasalChange()); } return result; @@ -366,16 +372,12 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI // TODO: logging all actions in configbuilder public PumpEnactResult applyAPSRequest(APSResult request) { request.rate = applyBasalConstraints(request.rate); - PumpEnactResult result = null; + PumpEnactResult result; if (request.rate == getBaseBasalRate()) { if (isTempBasalInProgress()) { result = cancelTempBasal(); - if (result.enacted) { - uploadTempBasalEnd(); - MainApp.bus().post(new EventTempBasalChange()); - } - } else { + } else { result = new PumpEnactResult(); result.absolute = request.rate; result.duration = 0; @@ -392,14 +394,6 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI result.success = true; } else { result = setTempBasalAbsolute(request.rate, request.duration); - if (result.enacted) { - if (result.isPercent) { - uploadTempBasalStartPercent(result.percent, result.duration); - } else { - uploadTempBasalStartAbsolute(result.absolute, result.duration); - } - MainApp.bus().post(new EventTempBasalChange()); - } } return result; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRFragment.java index c7089d68dc..75776a0f2a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRFragment.java @@ -508,6 +508,7 @@ public class DanaRFragment extends Fragment implements PluginBase, PumpInterface } if (Config.logPumpActions) log.debug("setTempBasalAbsolute: Extended bolus set ok"); + result.absolute = result.absolute + getBaseBasalRate(); return result; } // We should never end here