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