Merge pull request #502 from jotomo/combo-extractions
Combo extractions
This commit is contained in:
commit
a9f1acf7a7
6 changed files with 70 additions and 15 deletions
|
@ -30,21 +30,21 @@ public class Profile {
|
||||||
|
|
||||||
private JSONObject json;
|
private JSONObject json;
|
||||||
private String units = null;
|
private String units = null;
|
||||||
double dia = Constants.defaultDIA;
|
private double dia = Constants.defaultDIA;
|
||||||
TimeZone timeZone = TimeZone.getDefault();
|
private TimeZone timeZone = TimeZone.getDefault();
|
||||||
JSONArray isf;
|
private JSONArray isf;
|
||||||
private LongSparseArray<Double> isf_v = null; // oldest at index 0
|
private LongSparseArray<Double> isf_v = null; // oldest at index 0
|
||||||
JSONArray ic;
|
private JSONArray ic;
|
||||||
private LongSparseArray<Double> ic_v = null; // oldest at index 0
|
private LongSparseArray<Double> ic_v = null; // oldest at index 0
|
||||||
JSONArray basal;
|
private JSONArray basal;
|
||||||
private LongSparseArray<Double> basal_v = null; // oldest at index 0
|
private LongSparseArray<Double> basal_v = null; // oldest at index 0
|
||||||
JSONArray targetLow;
|
private JSONArray targetLow;
|
||||||
private LongSparseArray<Double> targetLow_v = null; // oldest at index 0
|
private LongSparseArray<Double> targetLow_v = null; // oldest at index 0
|
||||||
JSONArray targetHigh;
|
private JSONArray targetHigh;
|
||||||
private LongSparseArray<Double> targetHigh_v = null; // oldest at index 0
|
private LongSparseArray<Double> targetHigh_v = null; // oldest at index 0
|
||||||
|
|
||||||
int percentage = 100;
|
private int percentage = 100;
|
||||||
int timeshift = 0;
|
private int timeshift = 0;
|
||||||
|
|
||||||
public Profile(JSONObject json, String units) {
|
public Profile(JSONObject json, String units) {
|
||||||
this(json, 100, 0);
|
this(json, 100, 0);
|
||||||
|
@ -206,7 +206,7 @@ public class Profile {
|
||||||
return shiftedTime;
|
return shiftedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
double getMultiplier(LongSparseArray<Double> array) {
|
private double getMultiplier(LongSparseArray<Double> array) {
|
||||||
double multiplier = 1d;
|
double multiplier = 1d;
|
||||||
|
|
||||||
if (array == isf_v)
|
if (array == isf_v)
|
||||||
|
@ -220,7 +220,7 @@ public class Profile {
|
||||||
return multiplier;
|
return multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
double getMultiplier(JSONArray array) {
|
private double getMultiplier(JSONArray array) {
|
||||||
double multiplier = 1d;
|
double multiplier = 1d;
|
||||||
|
|
||||||
if (array == isf)
|
if (array == isf)
|
||||||
|
|
|
@ -32,6 +32,56 @@ public class PumpEnactResult extends Object {
|
||||||
|
|
||||||
public boolean queued = false;
|
public boolean queued = false;
|
||||||
|
|
||||||
|
public PumpEnactResult success(boolean success) {
|
||||||
|
this.success = success;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PumpEnactResult enacted(boolean enacted) {
|
||||||
|
this.enacted = enacted;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PumpEnactResult comment(String comment) {
|
||||||
|
this.comment = comment;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PumpEnactResult duration(Integer duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PumpEnactResult absolute(Double absolute) {
|
||||||
|
this.absolute = absolute;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PumpEnactResult isPercent(boolean isPercent) {
|
||||||
|
this.isPercent = isPercent;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PumpEnactResult isTempCancel(boolean isTempCancel) {
|
||||||
|
this.isTempCancel = isTempCancel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PumpEnactResult bolusDelivered(Double bolusDelivered) {
|
||||||
|
this.bolusDelivered = bolusDelivered;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PumpEnactResult carbsDelivered(Double carbsDelivered) {
|
||||||
|
this.carbsDelivered = carbsDelivered;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PumpEnactResult queued(boolean queued) {
|
||||||
|
this.queued = queued;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String log() {
|
public String log() {
|
||||||
return "Success: " + success + " Enacted: " + enacted + " Comment: " + comment + " Duration: " + duration + " Absolute: " + absolute + " Percent: " + percent + " IsPercent: " + isPercent + " Queued: " + queued;
|
return "Success: " + success + " Enacted: " + enacted + " Comment: " + comment + " Duration: " + duration + " Absolute: " + absolute + " Percent: " + percent + " IsPercent: " + isPercent + " Queued: " + queued;
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
tempBasal.setVisibility(View.GONE);
|
tempBasal.setVisibility(View.GONE);
|
||||||
tempBasalCancel.setVisibility(View.VISIBLE);
|
tempBasalCancel.setVisibility(View.VISIBLE);
|
||||||
final TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
final TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
||||||
tempBasalCancel.setText(MainApp.instance().getString(R.string.cancel) + "\n" + activeTemp.toStringShort());
|
tempBasalCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + activeTemp.toStringShort());
|
||||||
} else {
|
} else {
|
||||||
tempBasal.setVisibility(View.VISIBLE);
|
tempBasal.setVisibility(View.VISIBLE);
|
||||||
tempBasalCancel.setVisibility(View.GONE);
|
tempBasalCancel.setVisibility(View.GONE);
|
||||||
|
|
|
@ -194,11 +194,16 @@ public class PersistentNotificationPlugin implements PluginBase {
|
||||||
|
|
||||||
private void checkBusRegistration() {
|
private void checkBusRegistration() {
|
||||||
if (fragmentEnabled) {
|
if (fragmentEnabled) {
|
||||||
MainApp.bus().register(this);
|
try {
|
||||||
|
MainApp.bus().register(this);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
// already registered
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
MainApp.bus().unregister(this);
|
MainApp.bus().unregister(this);
|
||||||
} catch (Exception e) {
|
} catch (IllegalArgumentException e) {
|
||||||
|
// already unregistered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class VirtualPumpFragment extends SubscriberFragment {
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
try {
|
try {
|
||||||
View view = inflater.inflate(R.layout.vitualpump_fragment, container, false);
|
View view = inflater.inflate(R.layout.virtualpump_fragment, container, false);
|
||||||
basaBasalRateView = (TextView) view.findViewById(R.id.virtualpump_basabasalrate);
|
basaBasalRateView = (TextView) view.findViewById(R.id.virtualpump_basabasalrate);
|
||||||
tempBasalView = (TextView) view.findViewById(R.id.virtualpump_tempbasal);
|
tempBasalView = (TextView) view.findViewById(R.id.virtualpump_tempbasal);
|
||||||
extendedBolusView = (TextView) view.findViewById(R.id.virtualpump_extendedbolus);
|
extendedBolusView = (TextView) view.findViewById(R.id.virtualpump_extendedbolus);
|
||||||
|
|
Loading…
Reference in a new issue