move COB string representation to CobInfo
This commit is contained in:
parent
55db89b547
commit
f75329f5dc
|
@ -1,7 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.IobCobCalculator;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
|
||||
public class CobInfo {
|
||||
/** All COB up to now, including carbs not yet processed by IobCob calculation. */
|
||||
@Nullable
|
||||
|
@ -12,4 +15,19 @@ public class CobInfo {
|
|||
this.displayCob = displayCob;
|
||||
this.futureCarbs = futureCarbs;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static String generateCOBString() {
|
||||
|
||||
String cobStringResult = "--";
|
||||
CobInfo cobInfo = IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "WatcherUpdaterService");
|
||||
if (cobInfo.displayCob != null) {
|
||||
cobStringResult = DecimalFormatter.to0Decimal(cobInfo.displayCob);
|
||||
if (cobInfo.futureCarbs > 0) {
|
||||
cobStringResult += "(" + DecimalFormatter.to0Decimal(cobInfo.futureCarbs) + ")";
|
||||
}
|
||||
cobStringResult += "g";
|
||||
}
|
||||
return cobStringResult;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,8 +42,6 @@ import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
|||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSDeviceStatus;
|
||||
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||
|
@ -592,7 +590,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
|
||||
iobSum = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob);
|
||||
iobDetail = "(" + DecimalFormatter.to2Decimal(bolusIob.iob) + "|" + DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
|
||||
cobString = generateCOBString();
|
||||
cobString = CobInfo.generateCOBString();
|
||||
currentBasal = generateBasalString(treatmentsInterface);
|
||||
|
||||
//bgi
|
||||
|
@ -715,21 +713,6 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
return basalStringResult;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private String generateCOBString() {
|
||||
|
||||
String cobStringResult = "--";
|
||||
CobInfo cobInfo = IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "WatcherUpdaterService");
|
||||
if (cobInfo.displayCob != null) {
|
||||
cobStringResult = DecimalFormatter.to0Decimal(cobInfo.displayCob);
|
||||
if (cobInfo.futureCarbs > 0) {
|
||||
cobStringResult += "(" + DecimalFormatter.to0Decimal(cobInfo.futureCarbs) + ")";
|
||||
}
|
||||
cobStringResult += "g";
|
||||
}
|
||||
return cobStringResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (googleApiClient != null && googleApiClient.isConnected()) {
|
||||
|
|
Loading…
Reference in a new issue