From 63793ed358a550db2eeb751e905f78c8adf46a3a Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Wed, 16 Aug 2017 17:56:57 +0200 Subject: [PATCH] Show profile switch button in profiles Shows the button to trigger a profile switch button in the profile fragments even when the pump basal cannot be written. Instead of "SEND TO PUMP" it will then show "ACTIVATE PROFILE". This has become necessary with the interval logic that needs profile switch events to happen in order to accept a new profile. --- .../CircadianPercentageProfileFragment.java | 6 +++++- .../plugins/ProfileLocal/LocalProfileFragment.java | 6 +++++- .../plugins/ProfileSimple/SimpleProfileFragment.java | 6 +++++- app/src/main/res/values/strings.xml | 3 +-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfileFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfileFragment.java index c42f1d0c64..c7d7333aba 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfileFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfileFragment.java @@ -500,9 +500,13 @@ public class CircadianPercentageProfileFragment extends SubscriberFragment { activity.runOnUiThread(new Runnable() { @Override public void run() { - if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) { + if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) { profileswitchButton.setVisibility(View.GONE); + } else if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) { + profileswitchButton.setText(MainApp.instance().getText(R.string.activate_profile)); + profileswitchButton.setVisibility(View.VISIBLE); } else { + profileswitchButton.setText(MainApp.instance().getText(R.string.send_to_pump)); profileswitchButton.setVisibility(View.VISIBLE); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfileFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfileFragment.java index 7161a1d9de..e491a41b1b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfileFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfileFragment.java @@ -148,9 +148,13 @@ public class LocalProfileFragment extends SubscriberFragment { activity.runOnUiThread(new Runnable() { @Override public void run() { - if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) { + if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) { profileswitchButton.setVisibility(View.GONE); + } else if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) { + profileswitchButton.setText(MainApp.instance().getText(R.string.activate_profile)); + profileswitchButton.setVisibility(View.VISIBLE); } else { + profileswitchButton.setText(MainApp.instance().getText(R.string.send_to_pump)); profileswitchButton.setVisibility(View.VISIBLE); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfileFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfileFragment.java index a4e3a8eecf..5cf36409b6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfileFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfileFragment.java @@ -156,9 +156,13 @@ public class SimpleProfileFragment extends SubscriberFragment { activity.runOnUiThread(new Runnable() { @Override public void run() { - if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) { + if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) { profileswitchButton.setVisibility(View.GONE); + } else if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) { + profileswitchButton.setText(MainApp.instance().getText(R.string.activate_profile)); + profileswitchButton.setVisibility(View.VISIBLE); } else { + profileswitchButton.setText(MainApp.instance().getText(R.string.send_to_pump)); profileswitchButton.setVisibility(View.VISIBLE); } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 08d0008156..05cf2a6285 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -698,8 +698,7 @@ Rapid-Acting Oref Ultra-Rapid Oref "DIA of %s too short - using %s instead!" - - + ACTIVATE PROFILE