diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.java
index 33e07b071b..78bf406b1c 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.java
@@ -68,14 +68,22 @@ public class BolusActivity extends Activity {
final View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_editplusminus_item, container, false);
final TextView textView = (TextView) view.findViewById(R.id.label);
textView.setText("insulin");
- editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, 0d, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false);
+ double def = 0;
+ if (editInsulin != null){
+ def = SafeParse.stringToDouble(editInsulin.editText.getText().toString());
+ }
+ editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false);
container.addView(view);
return view;
} else if(col == 1){
final View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_editplusminus_item, container, false);
final TextView textView = (TextView) view.findViewById(R.id.label);
textView.setText("carbs");
- editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, 0d, 0d, 100d, 1d, new DecimalFormat("0"), false);
+ double def = 0;
+ if (editCarbs != null){
+ def = SafeParse.stringToDouble(editCarbs.editText.getText().toString());
+ }
+ editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 100d, 1d, new DecimalFormat("0"), false);
container.addView(view);
return view;
} else {
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.java
index 46352f7209..bb926ed584 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.java
@@ -67,7 +67,11 @@ public class FillActivity extends Activity {
final View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_editplusminus_item, container, false);
final TextView textView = (TextView) view.findViewById(R.id.label);
textView.setText("insulin");
- editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, 0d, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false);
+ double def = 0d;
+ if (editInsulin != null){
+ def = SafeParse.stringToDouble(editInsulin.editText.getText().toString());
+ }
+ editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false);
container.addView(view);
return view;
} else {
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.java
index 72acea3aaf..f3fef6c102 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.java
@@ -77,7 +77,12 @@ public class TempTargetActivity extends Activity {
final View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_editplusminus_item, container, false);
final TextView textView = (TextView) view.findViewById(R.id.label);
textView.setText("duration");
- time = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, 60d, 0d, 24*60d, 1d, new DecimalFormat("0"), false);
+ if (time == null) {
+ time = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, 60d, 0d, 24 * 60d, 1d, new DecimalFormat("0"), false);
+ } else {
+ double def = SafeParse.stringToDouble(time.editText.getText().toString());
+ time = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 24 * 60d, 1d, new DecimalFormat("0"), false);
+ }
container.addView(view);
return view;
@@ -86,9 +91,17 @@ public class TempTargetActivity extends Activity {
final TextView textView = (TextView) view.findViewById(R.id.label);
textView.setText("low");
if (isMGDL){
- lowRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, 100d, 72d, 180d, 1d, new DecimalFormat("0"), false);
+ double def = 100;
+ if (lowRange != null){
+ def = SafeParse.stringToDouble(lowRange.editText.getText().toString());
+ }
+ lowRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 72d, 180d, 1d, new DecimalFormat("0"), false);
} else {
- lowRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, 5.5, 4d, 10d, 0.1d, new DecimalFormat("#0.0"), false);
+ double def = 5.5;
+ if (lowRange != null){
+ def = SafeParse.stringToDouble(lowRange.editText.getText().toString());
+ }
+ lowRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 4d, 10d, 0.1d, new DecimalFormat("#0.0"), false);
}
container.addView(view);
@@ -98,9 +111,17 @@ public class TempTargetActivity extends Activity {
final TextView textView = (TextView) view.findViewById(R.id.label);
textView.setText("high");
if (isMGDL){
- highRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, 100d, 72d, 180d, 1d, new DecimalFormat("0"), false);
+ double def = 100;
+ if (highRange != null){
+ def = SafeParse.stringToDouble(highRange.editText.getText().toString());
+ }
+ highRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 72d, 180d, 1d, new DecimalFormat("0"), false);
} else {
- highRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, 5.5, 4d, 10d, 0.1d, new DecimalFormat("#0.0"), false);
+ double def = 5.5;
+ if (highRange != null){
+ def = SafeParse.stringToDouble(highRange.editText.getText().toString());
+ }
+ highRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 4d, 10d, 0.1d, new DecimalFormat("#0.0"), false);
}
container.addView(view);
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.java
index 50f77bb4b8..0e930174ae 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.java
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.java
@@ -71,7 +71,13 @@ public class WizardActivity extends Activity {
final View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_editplusminus_item, container, false);
final TextView textView = (TextView) view.findViewById(R.id.label);
textView.setText("carbs");
- editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, 0d, 0d, 100d, 1d, new DecimalFormat("0"), false);
+ if (editCarbs == null) {
+ editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, 0d, 0d, 100d, 1d, new DecimalFormat("0"), false);
+ } else {
+ double def = SafeParse.stringToDouble(editCarbs.editText.getText().toString());
+ editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 100d, 1d, new DecimalFormat("0"), false);
+
+ }
container.addView(view);
return view;
} else if(col == 1){
@@ -80,6 +86,11 @@ public class WizardActivity extends Activity {
textView.setText("include BG?");
final ImageView togglebutton = (ImageView) view.findViewById(R.id.togglebutton);
+ if(useBG){
+ togglebutton.setImageResource(R.drawable.ic_toggle_on);
+ } else {
+ togglebutton.setImageResource(R.drawable.ic_toggle_off);
+ }
togglebutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -99,6 +110,11 @@ public class WizardActivity extends Activity {
textView.setText("Bolus IOB?");
final ImageView togglebutton = (ImageView) view.findViewById(R.id.togglebutton);
+ if(includeBolusIOB){
+ togglebutton.setImageResource(R.drawable.ic_toggle_on);
+ } else {
+ togglebutton.setImageResource(R.drawable.ic_toggle_off);
+ }
togglebutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -118,6 +134,11 @@ public class WizardActivity extends Activity {
textView.setText("Basal IOB?");
final ImageView togglebutton = (ImageView) view.findViewById(R.id.togglebutton);
+ if(includeBasalIOB){
+ togglebutton.setImageResource(R.drawable.ic_toggle_on);
+ } else {
+ togglebutton.setImageResource(R.drawable.ic_toggle_off);
+ }
togglebutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/wear/wear.iml b/wear/wear.iml
index ce3df746e7..f2951e6bcf 100644
--- a/wear/wear.iml
+++ b/wear/wear.iml
@@ -43,6 +43,13 @@
+
+
+
+
+
+
+
@@ -51,13 +58,6 @@
-
-
-
-
-
-
-
@@ -66,14 +66,6 @@
-
-
-
-
-
-
-
-
@@ -82,6 +74,14 @@
+
+
+
+
+
+
+
+