From b1f3bb17bb816a012d60e1d6d77f4dd29ce8a812 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Wed, 2 Nov 2016 18:04:14 +0100 Subject: [PATCH 1/2] Show in Overview when loop is disabled --- .../plugins/Overview/OverviewFragment.java | 16 +++++++++++++--- app/src/main/res/values/strings.xml | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 5592b356a8..9952443a44 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -11,6 +11,7 @@ import android.os.Handler; import android.os.HandlerThread; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; +import android.support.v4.content.ContextCompat; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; @@ -429,9 +430,18 @@ public class OverviewFragment extends Fragment { final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun; if (Config.APS) { apsModeView.setVisibility(View.VISIBLE); - if (MainApp.getConfigBuilder().isClosedModeEnabled()) - apsModeView.setText(MainApp.sResources.getString(R.string.closedloop)); - else apsModeView.setText(MainApp.sResources.getString(R.string.openloop)); + apsModeView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorCancelTempButton)); + LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop(); + if(activeloop != null && activeloop.isEnabled(activeloop.getType())) { + if (MainApp.getConfigBuilder().isClosedModeEnabled()) { + apsModeView.setText(MainApp.sResources.getString(R.string.closedloop)); + } else { + apsModeView.setText(MainApp.sResources.getString(R.string.openloop)); + } + } else { + apsModeView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorSetExtendedButton)); + apsModeView.setText(MainApp.sResources.getString(R.string.disabledloop)); + } } else { apsModeView.setVisibility(View.GONE); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cc4efc71b0..6e86355943 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -132,6 +132,8 @@ Closed Loop Open Loop + Loop Disabled + New suggestion available Unsupported version of NSClient NSClient not installed. Record lost! From b7f4dd3366040e4c6fbb981458363e2cea36fdbc Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Wed, 2 Nov 2016 18:26:16 +0100 Subject: [PATCH 2/2] borders again on loopmode label --- .../androidaps/plugins/Overview/OverviewFragment.java | 4 ++-- app/src/main/res/drawable/loopmodedisabledborder.xml | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/drawable/loopmodedisabledborder.xml diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 9952443a44..401c612c75 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -430,7 +430,7 @@ public class OverviewFragment extends Fragment { final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun; if (Config.APS) { apsModeView.setVisibility(View.VISIBLE); - apsModeView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorCancelTempButton)); + apsModeView.setBackgroundResource(R.drawable.loopmodeborder); LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop(); if(activeloop != null && activeloop.isEnabled(activeloop.getType())) { if (MainApp.getConfigBuilder().isClosedModeEnabled()) { @@ -439,7 +439,7 @@ public class OverviewFragment extends Fragment { apsModeView.setText(MainApp.sResources.getString(R.string.openloop)); } } else { - apsModeView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorSetExtendedButton)); + apsModeView.setBackgroundResource(R.drawable.loopmodedisabledborder); apsModeView.setText(MainApp.sResources.getString(R.string.disabledloop)); } } else { diff --git a/app/src/main/res/drawable/loopmodedisabledborder.xml b/app/src/main/res/drawable/loopmodedisabledborder.xml new file mode 100644 index 0000000000..1d312404e0 --- /dev/null +++ b/app/src/main/res/drawable/loopmodedisabledborder.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file