From d7caa39ff383f46d1f53d78787d8003919c99ab8 Mon Sep 17 00:00:00 2001 From: Andries Smit Date: Wed, 1 Dec 2021 15:28:25 +0100 Subject: [PATCH] Wear improve menu navigation --- .../androidaps/interaction/actions/AcceptActivity.java | 2 +- .../androidaps/interaction/actions/BolusActivity.java | 2 +- .../androidaps/interaction/actions/CPPActivity.java | 2 +- .../androidaps/interaction/actions/ECarbActivity.java | 2 +- .../androidaps/interaction/actions/FillActivity.java | 2 +- .../interaction/actions/TempTargetActivity.java | 2 +- .../androidaps/interaction/actions/WizardActivity.java | 2 +- .../androidaps/interaction/utils/MenuListActivity.java | 9 +-------- 8 files changed, 8 insertions(+), 15 deletions(-) diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/AcceptActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/AcceptActivity.java index 6a5b9b5f9a..5000b47577 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/AcceptActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/AcceptActivity.java @@ -99,7 +99,7 @@ public class AcceptActivity extends ViewSelectorActivity { @Override public void onClick(View v) { ListenerService.confirmAction(AcceptActivity.this, actionstring); - finish(); + finishAffinity(); } }); container.addView(view); 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 4382f8d323..27b812459c 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 @@ -113,7 +113,7 @@ public class BolusActivity extends ViewSelectorActivity { String actionstring = "bolus " + SafeParse.stringToDouble(editInsulin.editText.getText().toString()) + " " + SafeParse.stringToInt(editCarbs.editText.getText().toString()); ListenerService.initiateAction(BolusActivity.this, actionstring); - finish(); + finishAffinity(); } }); container.addView(view); diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CPPActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CPPActivity.java index a2cc5f2b4d..e0525048a7 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CPPActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CPPActivity.java @@ -129,7 +129,7 @@ public class CPPActivity extends ViewSelectorActivity { String actionstring = "cppset " + SafeParse.stringToInt(editTimeshift.editText.getText().toString()) + " " + SafeParse.stringToInt(editPercentage.editText.getText().toString()); ListenerService.initiateAction(CPPActivity.this, actionstring); - finish(); + finishAffinity(); } }); container.addView(view); diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java index 33835ff01f..8954a312da 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java @@ -127,7 +127,7 @@ public class ECarbActivity extends ViewSelectorActivity { + " " + SafeParse.stringToInt(editStartTime.editText.getText().toString()) + " " + SafeParse.stringToInt(editDuration.editText.getText().toString()); ListenerService.initiateAction(ECarbActivity.this, actionstring); - finish(); + finishAffinity(); } }); container.addView(view); 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 e17c8bb724..f10f0ec192 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 @@ -85,7 +85,7 @@ public class FillActivity extends ViewSelectorActivity { String actionstring = "fill " + SafeParse.stringToDouble(editInsulin.editText.getText().toString()); ListenerService.initiateAction(FillActivity.this, actionstring); - finish(); + finishAffinity(); } }); container.addView(view); 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 17515ad282..10018af882 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 @@ -162,7 +162,7 @@ public class TempTargetActivity extends ViewSelectorActivity { + " " + (isSingleTarget ? SafeParse.stringToDouble(lowRange.editText.getText().toString()) : SafeParse.stringToDouble(highRange.editText.getText().toString())); ListenerService.initiateAction(TempTargetActivity.this, actionstring); - finish(); + finishAffinity(); } }); 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 6ab4f3375c..d58f2ab387 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 @@ -129,7 +129,7 @@ public class WizardActivity extends ViewSelectorActivity { String actionstring = "wizard2 " + SafeParse.stringToInt(editCarbs.editText.getText().toString()) + " " + percentage; ListenerService.initiateAction(WizardActivity.this, actionstring); - finish(); + finishAffinity(); } }); container.addView(view); diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/MenuListActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/MenuListActivity.java index 98583cf2cb..e9302f8b23 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/MenuListActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/MenuListActivity.java @@ -28,12 +28,6 @@ public abstract class MenuListActivity extends Activity protected abstract void doAction(String position); - @Override - protected void onPause(){ - super.onPause(); - finish(); - } - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -56,8 +50,7 @@ public abstract class MenuListActivity extends Activity public void onClick(WearableListView.ViewHolder v) { String tag = (String) v.itemView.getTag(); doAction(tag); - //ActionsDefinitions.doAction(v.getAdapterPosition(), this); - finish(); + } @Override