Merge pull request #502 from jotomo/combo-extractions

Combo extractions
This commit is contained in:
Milos Kozak 2017-11-22 19:36:59 +01:00 committed by GitHub
commit a9f1acf7a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 15 deletions

View file

@ -30,21 +30,21 @@ public class Profile {
private JSONObject json;
private String units = null;
double dia = Constants.defaultDIA;
TimeZone timeZone = TimeZone.getDefault();
JSONArray isf;
private double dia = Constants.defaultDIA;
private TimeZone timeZone = TimeZone.getDefault();
private JSONArray isf;
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
JSONArray basal;
private JSONArray basal;
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
JSONArray targetHigh;
private JSONArray targetHigh;
private LongSparseArray<Double> targetHigh_v = null; // oldest at index 0
int percentage = 100;
int timeshift = 0;
private int percentage = 100;
private int timeshift = 0;
public Profile(JSONObject json, String units) {
this(json, 100, 0);
@ -206,7 +206,7 @@ public class Profile {
return shiftedTime;
}
double getMultiplier(LongSparseArray<Double> array) {
private double getMultiplier(LongSparseArray<Double> array) {
double multiplier = 1d;
if (array == isf_v)
@ -220,7 +220,7 @@ public class Profile {
return multiplier;
}
double getMultiplier(JSONArray array) {
private double getMultiplier(JSONArray array) {
double multiplier = 1d;
if (array == isf)

View file

@ -32,6 +32,56 @@ public class PumpEnactResult extends Object {
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() {
return "Success: " + success + " Enacted: " + enacted + " Comment: " + comment + " Duration: " + duration + " Absolute: " + absolute + " Percent: " + percent + " IsPercent: " + isPercent + " Queued: " + queued;
}

View file

@ -166,7 +166,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
tempBasal.setVisibility(View.GONE);
tempBasalCancel.setVisibility(View.VISIBLE);
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 {
tempBasal.setVisibility(View.VISIBLE);
tempBasalCancel.setVisibility(View.GONE);

View file

@ -194,11 +194,16 @@ public class PersistentNotificationPlugin implements PluginBase {
private void checkBusRegistration() {
if (fragmentEnabled) {
MainApp.bus().register(this);
try {
MainApp.bus().register(this);
} catch (IllegalArgumentException e) {
// already registered
}
} else {
try {
MainApp.bus().unregister(this);
} catch (Exception e) {
} catch (IllegalArgumentException e) {
// already unregistered
}
}
}

View file

@ -52,7 +52,7 @@ public class VirtualPumpFragment extends SubscriberFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
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);
tempBasalView = (TextView) view.findViewById(R.id.virtualpump_tempbasal);
extendedBolusView = (TextView) view.findViewById(R.id.virtualpump_extendedbolus);