fix copy constructors in automation plugin
This commit is contained in:
parent
d452d21c93
commit
139455747e
7 changed files with 20 additions and 19 deletions
|
@ -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);
|
||||
|
|
|
@ -19,7 +19,7 @@ public class InputTempTarget extends Element {
|
|||
private double step;
|
||||
private DecimalFormat decimalFormat;
|
||||
|
||||
final TextWatcher textWatcher = new TextWatcher() {
|
||||
private final TextWatcher textWatcher = new TextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
value = Math.max(minValue, value);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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