Merge branch 'dev' into objectives
This commit is contained in:
commit
6b388b3bd2
12 changed files with 49 additions and 28 deletions
|
@ -218,10 +218,8 @@ public class MainApp extends Application {
|
||||||
pluginsList.add(StatuslinePlugin.initPlugin(this));
|
pluginsList.add(StatuslinePlugin.initPlugin(this));
|
||||||
pluginsList.add(PersistentNotificationPlugin.getPlugin());
|
pluginsList.add(PersistentNotificationPlugin.getPlugin());
|
||||||
pluginsList.add(NSClientPlugin.getPlugin());
|
pluginsList.add(NSClientPlugin.getPlugin());
|
||||||
if (engineeringMode)
|
// if (engineeringMode) pluginsList.add(TidepoolPlugin.INSTANCE);
|
||||||
pluginsList.add(TidepoolPlugin.INSTANCE);
|
|
||||||
pluginsList.add(MaintenancePlugin.initPlugin(this));
|
pluginsList.add(MaintenancePlugin.initPlugin(this));
|
||||||
if (engineeringMode)
|
|
||||||
pluginsList.add(AutomationPlugin.INSTANCE);
|
pluginsList.add(AutomationPlugin.INSTANCE);
|
||||||
|
|
||||||
pluginsList.add(ConfigBuilderPlugin.getPlugin());
|
pluginsList.add(ConfigBuilderPlugin.getPlugin());
|
||||||
|
|
|
@ -290,7 +290,7 @@ public class LoopPlugin extends PluginBase {
|
||||||
|
|
||||||
Profile profile = ProfileFunctions.getInstance().getProfile();
|
Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
|
|
||||||
if (!ProfileFunctions.getInstance().isProfileValid("Loop")) {
|
if (profile == null || !ProfileFunctions.getInstance().isProfileValid("Loop")) {
|
||||||
if (L.isEnabled(L.APS))
|
if (L.isEnabled(L.APS))
|
||||||
log.debug(MainApp.gs(R.string.noprofileselected));
|
log.debug(MainApp.gs(R.string.noprofileselected));
|
||||||
RxBus.INSTANCE.send(new EventLoopSetLastRunGui(MainApp.gs(R.string.noprofileselected)));
|
RxBus.INSTANCE.send(new EventLoopSetLastRunGui(MainApp.gs(R.string.noprofileselected)));
|
||||||
|
|
|
@ -84,14 +84,13 @@ class EventListAdapter extends RecyclerView.Adapter<EventListAdapter.ViewHolder>
|
||||||
// enabled event
|
// enabled event
|
||||||
holder.enabled.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
holder.enabled.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
event.setEnabled(isChecked);
|
event.setEnabled(isChecked);
|
||||||
notifyDataSetChanged();
|
|
||||||
RxBus.INSTANCE.send(new EventAutomationDataChanged());
|
RxBus.INSTANCE.send(new EventAutomationDataChanged());
|
||||||
});
|
});
|
||||||
|
|
||||||
// remove event
|
// remove event
|
||||||
holder.iconTrash.setOnClickListener(v -> {
|
holder.iconTrash.setOnClickListener(v -> {
|
||||||
mEventList.remove(event);
|
mEventList.remove(event);
|
||||||
notifyDataSetChanged();
|
RxBus.INSTANCE.send(new EventAutomationDataChanged());
|
||||||
});
|
});
|
||||||
|
|
||||||
// edit event
|
// edit event
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class ActionStartTempTarget extends Action {
|
||||||
int unitResId = value.getUnits().equals(Constants.MGDL) ? R.string.mgdl : R.string.mmol;
|
int unitResId = value.getUnits().equals(Constants.MGDL) ? R.string.mgdl : R.string.mmol;
|
||||||
|
|
||||||
new LayoutBuilder()
|
new LayoutBuilder()
|
||||||
.add(new LabelWithElement(MainApp.gs(R.string.careportal_temporarytarget), MainApp.gs(unitResId), value))
|
.add(new LabelWithElement(MainApp.gs(R.string.careportal_temporarytarget) + " [" + MainApp.gs(unitResId) + "]", "", value))
|
||||||
.add(new LabelWithElement(MainApp.gs(R.string.careportal_newnstreatment_duration_min_label), "", duration))
|
.add(new LabelWithElement(MainApp.gs(R.string.careportal_newnstreatment_duration_min_label), "", duration))
|
||||||
.build(root);
|
.build(root);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@ public class InputDouble extends Element {
|
||||||
};
|
};
|
||||||
|
|
||||||
private double value;
|
private double value;
|
||||||
double minValue;
|
private double minValue;
|
||||||
double maxValue;
|
private double maxValue;
|
||||||
private double step;
|
private double step;
|
||||||
private DecimalFormat decimalFormat;
|
private DecimalFormat decimalFormat;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,11 @@ public class InputDuration extends Element {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InputDuration(InputDuration another) {
|
||||||
|
unit = another.unit;
|
||||||
|
value = another.value;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addToLayout(LinearLayout root) {
|
public void addToLayout(LinearLayout root) {
|
||||||
NumberPicker numberPicker = new NumberPicker(root.getContext(), null);
|
NumberPicker numberPicker = new NumberPicker(root.getContext(), null);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements;
|
package info.nightscout.androidaps.plugins.general.automation.elements;
|
||||||
|
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
@ -17,6 +19,22 @@ public class InputTempTarget extends Element {
|
||||||
private double step;
|
private double step;
|
||||||
private DecimalFormat decimalFormat;
|
private DecimalFormat decimalFormat;
|
||||||
|
|
||||||
|
private final TextWatcher textWatcher = new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
value = Math.max(minValue, value);
|
||||||
|
value = Math.min(maxValue, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public InputTempTarget() {
|
public InputTempTarget() {
|
||||||
super();
|
super();
|
||||||
setUnits(ProfileFunctions.getInstance().getProfileUnits());
|
setUnits(ProfileFunctions.getInstance().getProfileUnits());
|
||||||
|
@ -36,7 +54,7 @@ public class InputTempTarget extends Element {
|
||||||
@Override
|
@Override
|
||||||
public void addToLayout(LinearLayout root) {
|
public void addToLayout(LinearLayout root) {
|
||||||
NumberPicker numberPicker = new NumberPicker(root.getContext(), null);
|
NumberPicker numberPicker = new NumberPicker(root.getContext(), null);
|
||||||
numberPicker.setParams(value, minValue, maxValue, step, decimalFormat, true, null, null);
|
numberPicker.setParams(value, minValue, maxValue, step, decimalFormat, true, null, textWatcher);
|
||||||
numberPicker.setOnValueChangedListener(value -> this.value = value);
|
numberPicker.setOnValueChangedListener(value -> this.value = value);
|
||||||
root.addView(numberPicker);
|
root.addView(numberPicker);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TableLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -37,6 +38,10 @@ public class LabelWithElement extends Element {
|
||||||
textViewPre.setTypeface(textViewPre.getTypeface(), Typeface.BOLD);
|
textViewPre.setTypeface(textViewPre.getTypeface(), Typeface.BOLD);
|
||||||
layout.addView(textViewPre);
|
layout.addView(textViewPre);
|
||||||
|
|
||||||
|
TextView spacer = new TextView(root.getContext());
|
||||||
|
spacer.setLayoutParams(new TableLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1f));
|
||||||
|
layout.addView(spacer);
|
||||||
|
|
||||||
// add element to layout
|
// add element to layout
|
||||||
element.addToLayout(layout);
|
element.addToLayout(layout);
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@ import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
@ -28,9 +26,7 @@ import info.nightscout.androidaps.utils.T;
|
||||||
|
|
||||||
public class TriggerBolusAgo extends Trigger {
|
public class TriggerBolusAgo extends Trigger {
|
||||||
private static Logger log = LoggerFactory.getLogger(L.AUTOMATION);
|
private static Logger log = LoggerFactory.getLogger(L.AUTOMATION);
|
||||||
private final double step = 1;
|
private InputDuration minutesAgo = new InputDuration(0, InputDuration.TimeUnit.MINUTES);
|
||||||
private DecimalFormat decimalFormat = new DecimalFormat("1");
|
|
||||||
public InputDuration minutesAgo = new InputDuration(0, InputDuration.TimeUnit.MINUTES);
|
|
||||||
private Comparator comparator = new Comparator();
|
private Comparator comparator = new Comparator();
|
||||||
|
|
||||||
public TriggerBolusAgo() {
|
public TriggerBolusAgo() {
|
||||||
|
@ -39,7 +35,7 @@ public class TriggerBolusAgo extends Trigger {
|
||||||
|
|
||||||
private TriggerBolusAgo(TriggerBolusAgo triggerBolusAgo) {
|
private TriggerBolusAgo(TriggerBolusAgo triggerBolusAgo) {
|
||||||
super();
|
super();
|
||||||
minutesAgo = new InputDuration(triggerBolusAgo.minutesAgo.getMinutes(), InputDuration.TimeUnit.MINUTES);
|
minutesAgo = new InputDuration(triggerBolusAgo.minutesAgo);
|
||||||
lastRun = triggerBolusAgo.lastRun;
|
lastRun = triggerBolusAgo.lastRun;
|
||||||
comparator = new Comparator(triggerBolusAgo.comparator);
|
comparator = new Comparator(triggerBolusAgo.comparator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,8 @@ import info.nightscout.androidaps.utils.T;
|
||||||
public class TriggerCOB extends Trigger {
|
public class TriggerCOB extends Trigger {
|
||||||
private static Logger log = LoggerFactory.getLogger(L.AUTOMATION);
|
private static Logger log = LoggerFactory.getLogger(L.AUTOMATION);
|
||||||
private final int minValue = 0;
|
private final int minValue = 0;
|
||||||
private final int maxValue = (int) (SP.getInt(R.string.key_treatmentssafety_maxcarbs, 48));
|
private final int maxValue = SP.getInt(R.string.key_treatmentssafety_maxcarbs, 48);
|
||||||
private final double step = 1;
|
private InputDouble value = new InputDouble(0, (double) minValue, (double) maxValue, 1, new DecimalFormat("1"));
|
||||||
private DecimalFormat decimalFormat = new DecimalFormat("1");
|
|
||||||
private InputDouble value = new InputDouble(0, (double) minValue, (double) maxValue, step, decimalFormat);
|
|
||||||
private Comparator comparator = new Comparator();
|
private Comparator comparator = new Comparator();
|
||||||
|
|
||||||
public TriggerCOB() {
|
public TriggerCOB() {
|
||||||
|
|
|
@ -51,10 +51,11 @@ public class TriggerDelta extends Trigger {
|
||||||
|
|
||||||
private TriggerDelta(TriggerDelta triggerDelta) {
|
private TriggerDelta(TriggerDelta triggerDelta) {
|
||||||
super();
|
super();
|
||||||
this.units = ProfileFunctions.getInstance().getProfileUnits();
|
|
||||||
initializer();
|
|
||||||
value = triggerDelta.value;
|
|
||||||
lastRun = triggerDelta.lastRun;
|
lastRun = triggerDelta.lastRun;
|
||||||
|
this.units = triggerDelta.units;
|
||||||
|
deltaType = triggerDelta.deltaType;
|
||||||
|
value = new InputDelta(triggerDelta.value);
|
||||||
|
comparator = new Comparator(triggerDelta.comparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getValue() {
|
public double getValue() {
|
||||||
|
@ -68,7 +69,7 @@ public class TriggerDelta extends Trigger {
|
||||||
if (units.equals(Constants.MMOL))
|
if (units.equals(Constants.MMOL))
|
||||||
value = new InputDelta(0, -MMOL_MAX, MMOL_MAX, 0.1d, new DecimalFormat("0.1"), DeltaType.DELTA);
|
value = new InputDelta(0, -MMOL_MAX, MMOL_MAX, 0.1d, new DecimalFormat("0.1"), DeltaType.DELTA);
|
||||||
else
|
else
|
||||||
value = new InputDelta(0, -MGDL_MAX, MGDL_MAX, 0.1d, new DecimalFormat("1"), DeltaType.DELTA);
|
value = new InputDelta(0, -MGDL_MAX, MGDL_MAX, 1d, new DecimalFormat("1"), DeltaType.DELTA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,11 @@ public class TriggerLocation extends Trigger {
|
||||||
|
|
||||||
private TriggerLocation(TriggerLocation triggerLocation) {
|
private TriggerLocation(TriggerLocation triggerLocation) {
|
||||||
super();
|
super();
|
||||||
latitude = new InputDouble(triggerLocation.latitude.getValue(), -90d, +90d, 0.00001d, new DecimalFormat("0.00000"));
|
latitude = new InputDouble(triggerLocation.latitude);
|
||||||
longitude = new InputDouble(triggerLocation.longitude.getValue(), -180d, +180d, 0.00001d, new DecimalFormat("0.00000"));
|
longitude = new InputDouble(triggerLocation.longitude);
|
||||||
distance = new InputDouble(200d, 0, 100000, 10d, new DecimalFormat("0"));
|
distance = new InputDouble(triggerLocation.distance);
|
||||||
lastRun = triggerLocation.lastRun;
|
lastRun = triggerLocation.lastRun;
|
||||||
|
name = triggerLocation.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue