From 37e00d33aad510bdd867b4ea72016525a6d820ee Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Sun, 30 Apr 2017 20:20:04 +0200 Subject: [PATCH] wear setting for single temp target instead of range --- .../interaction/actions/TempTargetActivity.java | 14 ++++++++++---- wear/src/main/res/xml/preferences.xml | 7 +++++++ 2 files changed, 17 insertions(+), 4 deletions(-) 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 d5f53be4f6..2981066bfb 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 @@ -35,6 +35,7 @@ public class TempTargetActivity extends ViewSelectorActivity { PlusMinusEditText highRange; PlusMinusEditText time; boolean isMGDL; + boolean isSingleTarget; @Override protected void onCreate(Bundle savedInstanceState) { @@ -49,6 +50,7 @@ public class TempTargetActivity extends ViewSelectorActivity { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); isMGDL = sp.getBoolean("units_mgdl", true); + isSingleTarget = sp.getBoolean("singletarget", false); } @@ -62,7 +64,7 @@ public class TempTargetActivity extends ViewSelectorActivity { private class MyGridViewPagerAdapter extends GridPagerAdapter { @Override public int getColumnCount(int arg0) { - return 4; + return isSingleTarget?3:4; } @Override @@ -102,10 +104,14 @@ public class TempTargetActivity extends ViewSelectorActivity { } lowRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 4d, 10d, 0.1d, new DecimalFormat("#0.0"), false); } - setLabelToPlusMinusView(view, "low"); + if(isSingleTarget){ + setLabelToPlusMinusView(view, "target"); + } else { + setLabelToPlusMinusView(view, "low"); + } container.addView(view); return view; - } else if(col == 2){ + } else if(col == 2 && ! isSingleTarget){ final View view = getInflatedPlusMinusView(container); if (isMGDL){ double def = 100; @@ -138,7 +144,7 @@ public class TempTargetActivity extends ViewSelectorActivity { + " " + isMGDL + " " + SafeParse.stringToInt(time.editText.getText().toString()) + " " + SafeParse.stringToDouble(lowRange.editText.getText().toString()) - + " " + SafeParse.stringToDouble(highRange.editText.getText().toString()) + + " " + (isSingleTarget?SafeParse.stringToDouble(lowRange.editText.getText().toString()):SafeParse.stringToDouble(highRange.editText.getText().toString())) ; ListenerService.initiateAction(TempTargetActivity.this, actionstring); diff --git a/wear/src/main/res/xml/preferences.xml b/wear/src/main/res/xml/preferences.xml index 3e528e27f9..57050ef0f5 100644 --- a/wear/src/main/res/xml/preferences.xml +++ b/wear/src/main/res/xml/preferences.xml @@ -128,4 +128,11 @@ android:title="Prime in Menu" app:wear_iconOff="@drawable/settings_off" app:wear_iconOn="@drawable/settings_on"/> +