formating fix

This commit is contained in:
Milos Kozak 2016-07-11 18:42:14 +02:00
parent 4dff8bc6af
commit 4c21fe8383
3 changed files with 13 additions and 18 deletions

View file

@ -59,7 +59,7 @@ public class BgReading implements DataPointInterface {
public String valueToUnitsToString(String units) { public String valueToUnitsToString(String units) {
if (units.equals(Constants.MGDL)) return DecimalFormatter.to0Decimal(value); 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 @Override

View file

@ -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); loopDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainActivity.getSpecificPluginsList(PluginBase.LOOP), PluginBase.LOOP);
loopListView.setAdapter(loopDataAdapter); loopListView.setAdapter(loopDataAdapter);
setListViewHeightBasedOnChildren(loopListView); 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); treatmentsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainActivity.getSpecificPluginsList(PluginBase.TREATMENT), PluginBase.TREATMENT);
treatmentsListView.setAdapter(treatmentsDataAdapter); treatmentsListView.setAdapter(treatmentsDataAdapter);
setListViewHeightBasedOnChildren(treatmentsListView); 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); apsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainActivity.getSpecificPluginsList(PluginBase.APS), PluginBase.APS);
apsListView.setAdapter(apsDataAdapter); apsListView.setAdapter(apsDataAdapter);
setListViewHeightBasedOnChildren(apsListView); 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); constraintsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainActivity.getSpecificPluginsListByInterface(ConstraintsInterface.class), PluginBase.CONSTRAINTS);
constraintsListView.setAdapter(constraintsDataAdapter); constraintsListView.setAdapter(constraintsDataAdapter);
setListViewHeightBasedOnChildren(constraintsListView); setListViewHeightBasedOnChildren(constraintsListView);
@ -307,7 +309,11 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
Double rateAfterConstraints = applyBasalConstraints(absoluteRate); Double rateAfterConstraints = applyBasalConstraints(absoluteRate);
PumpEnactResult result = activePump.setTempBasalAbsolute(rateAfterConstraints, durationInMinutes); PumpEnactResult result = activePump.setTempBasalAbsolute(rateAfterConstraints, durationInMinutes);
if (result.enacted && result.success) { 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()); MainApp.bus().post(new EventTempBasalChange());
} }
return result; return result;
@ -366,16 +372,12 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
// TODO: logging all actions in configbuilder // TODO: logging all actions in configbuilder
public PumpEnactResult applyAPSRequest(APSResult request) { public PumpEnactResult applyAPSRequest(APSResult request) {
request.rate = applyBasalConstraints(request.rate); request.rate = applyBasalConstraints(request.rate);
PumpEnactResult result = null; PumpEnactResult result;
if (request.rate == getBaseBasalRate()) { if (request.rate == getBaseBasalRate()) {
if (isTempBasalInProgress()) { if (isTempBasalInProgress()) {
result = cancelTempBasal(); result = cancelTempBasal();
if (result.enacted) { } else {
uploadTempBasalEnd();
MainApp.bus().post(new EventTempBasalChange());
}
} else {
result = new PumpEnactResult(); result = new PumpEnactResult();
result.absolute = request.rate; result.absolute = request.rate;
result.duration = 0; result.duration = 0;
@ -392,14 +394,6 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
result.success = true; result.success = true;
} else { } else {
result = setTempBasalAbsolute(request.rate, request.duration); 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; return result;
} }

View file

@ -508,6 +508,7 @@ public class DanaRFragment extends Fragment implements PluginBase, PumpInterface
} }
if (Config.logPumpActions) if (Config.logPumpActions)
log.debug("setTempBasalAbsolute: Extended bolus set ok"); log.debug("setTempBasalAbsolute: Extended bolus set ok");
result.absolute = result.absolute + getBaseBasalRate();
return result; return result;
} }
// We should never end here // We should never end here