From 414cb5fd8d0cef4d10f33d524a02ff05b5fc3b2b Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Mon, 16 Oct 2017 12:54:17 +0200 Subject: [PATCH 1/2] sum on name for LP --- .../androidaps/db/ProfileSwitch.java | 5 +++ .../ProfileLocal/LocalProfilePlugin.java | 39 ++++++++++--------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/db/ProfileSwitch.java b/app/src/main/java/info/nightscout/androidaps/db/ProfileSwitch.java index e8e2ded5b3..8bcd192d59 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/ProfileSwitch.java +++ b/app/src/main/java/info/nightscout/androidaps/db/ProfileSwitch.java @@ -16,7 +16,9 @@ import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.interfaces.Interval; import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface; import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries; +import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfilePlugin; import info.nightscout.utils.DateUtil; +import info.nightscout.utils.DecimalFormatter; @DatabaseTable(tableName = DatabaseHelper.DATABASE_PROFILESWITCHES) public class ProfileSwitch implements Interval, DataPointWithLabelInterface { @@ -66,6 +68,9 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface { public String getCustomizedName() { String name = profileName; + if(LocalProfilePlugin.LOCAL_PROFILE.equals(name)){ + name = DecimalFormatter.to2Decimal(getProfileObject().percentageBasalSum()) + "U "; + } if (isCPP) { name += "(" + percentage + "%," + timeshift + "h)"; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java index d8f1eda18b..db22677a82 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java @@ -23,6 +23,7 @@ import info.nightscout.utils.SP; * Created by mike on 05.08.2016. */ public class LocalProfilePlugin implements PluginBase, ProfileInterface { + public static final String LOCAL_PROFILE = "LocalProfile"; private static Logger log = LoggerFactory.getLogger(LocalProfilePlugin.class); private boolean fragmentEnabled = false; @@ -110,14 +111,14 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { public void storeSettings() { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); SharedPreferences.Editor editor = settings.edit(); - editor.putBoolean("LocalProfile" + "mmol", mmol); - editor.putBoolean("LocalProfile" + "mgdl", mgdl); - editor.putString("LocalProfile" + "dia", dia.toString()); - editor.putString("LocalProfile" + "ic", ic.toString()); - editor.putString("LocalProfile" + "isf", isf.toString()); - editor.putString("LocalProfile" + "basal", basal.toString()); - editor.putString("LocalProfile" + "targetlow", targetLow.toString()); - editor.putString("LocalProfile" + "targethigh", targetHigh.toString()); + editor.putBoolean(LOCAL_PROFILE + "mmol", mmol); + editor.putBoolean(LOCAL_PROFILE + "mgdl", mgdl); + editor.putString(LOCAL_PROFILE + "dia", dia.toString()); + editor.putString(LOCAL_PROFILE + "ic", ic.toString()); + editor.putString(LOCAL_PROFILE + "isf", isf.toString()); + editor.putString(LOCAL_PROFILE + "basal", basal.toString()); + editor.putString(LOCAL_PROFILE + "targetlow", targetLow.toString()); + editor.putString(LOCAL_PROFILE + "targethigh", targetHigh.toString()); editor.apply(); createConvertedProfile(); @@ -129,11 +130,11 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { if (Config.logPrefsChange) log.debug("Loading stored settings"); - mgdl = SP.getBoolean("LocalProfile" + "mgdl", false); - mmol = SP.getBoolean("LocalProfile" + "mmol", true); - dia = SP.getDouble("LocalProfile" + "dia", Constants.defaultDIA); + mgdl = SP.getBoolean(LOCAL_PROFILE + "mgdl", false); + mmol = SP.getBoolean(LOCAL_PROFILE + "mmol", true); + dia = SP.getDouble(LOCAL_PROFILE + "dia", Constants.defaultDIA); try { - ic = new JSONArray(SP.getString("LocalProfile" + "ic", DEFAULTARRAY)); + ic = new JSONArray(SP.getString(LOCAL_PROFILE + "ic", DEFAULTARRAY)); } catch (JSONException e1) { try { ic = new JSONArray(DEFAULTARRAY); @@ -141,7 +142,7 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { } } try { - isf = new JSONArray(SP.getString("LocalProfile" + "isf", DEFAULTARRAY)); + isf = new JSONArray(SP.getString(LOCAL_PROFILE + "isf", DEFAULTARRAY)); } catch (JSONException e1) { try { isf = new JSONArray(DEFAULTARRAY); @@ -149,7 +150,7 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { } } try { - basal = new JSONArray(SP.getString("LocalProfile" + "basal", DEFAULTARRAY)); + basal = new JSONArray(SP.getString(LOCAL_PROFILE + "basal", DEFAULTARRAY)); } catch (JSONException e1) { try { basal = new JSONArray(DEFAULTARRAY); @@ -157,7 +158,7 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { } } try { - targetLow = new JSONArray(SP.getString("LocalProfile" + "targetlow", DEFAULTARRAY)); + targetLow = new JSONArray(SP.getString(LOCAL_PROFILE + "targetlow", DEFAULTARRAY)); } catch (JSONException e1) { try { targetLow = new JSONArray(DEFAULTARRAY); @@ -165,7 +166,7 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { } } try { - targetHigh = new JSONArray(SP.getString("LocalProfile" + "targethigh", DEFAULTARRAY)); + targetHigh = new JSONArray(SP.getString(LOCAL_PROFILE + "targethigh", DEFAULTARRAY)); } catch (JSONException e1) { try { targetHigh = new JSONArray(DEFAULTARRAY); @@ -219,7 +220,7 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { JSONObject profile = new JSONObject(); try { - json.put("defaultProfile", "LocalProfile"); + json.put("defaultProfile", LOCAL_PROFILE); json.put("store", store); profile.put("dia", dia); profile.put("carbratio", ic); @@ -228,12 +229,12 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { profile.put("target_low", targetLow); profile.put("target_high", targetHigh); profile.put("units", mgdl ? Constants.MGDL : Constants.MMOL); - store.put("LocalProfile", profile); + store.put(LOCAL_PROFILE, profile); } catch (JSONException e) { log.error("Unhandled exception", e); } convertedProfile = new ProfileStore(json); - convertedProfileName = "LocalProfile"; + convertedProfileName = LOCAL_PROFILE; } @Override From fee19db5018eb6fcc014534a0d55bf92d35494c9 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sat, 14 Oct 2017 11:20:31 +0200 Subject: [PATCH 2/2] ConfigBuilder: hide disabled plugins by default. --- .../androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java | 2 +- .../androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java | 2 +- .../CircadianPercentageProfilePlugin.java | 2 +- .../androidaps/plugins/ProfileLocal/LocalProfilePlugin.java | 2 +- .../androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java | 2 +- .../plugins/SmsCommunicator/SmsCommunicatorPlugin.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java index 1e574bcc6c..be7b830880 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java @@ -55,7 +55,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface { AutosensResult lastAutosensResult = null; private boolean fragmentEnabled = false; - private boolean fragmentVisible = true; + private boolean fragmentVisible = false; @Override public String getName() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java index 9b9bdcbbf8..4d5f97c1b0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java @@ -53,7 +53,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface { DetermineBasalResultMA lastAPSResult = null; private boolean fragmentEnabled = false; - private boolean fragmentVisible = true; + private boolean fragmentVisible = false; @Override public String getName() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfilePlugin.java index 62b0326eae..2afb47e034 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfilePlugin.java @@ -38,7 +38,7 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte private static Logger log = LoggerFactory.getLogger(CircadianPercentageProfilePlugin.class); private boolean fragmentEnabled = false; - private boolean fragmentVisible = true; + private boolean fragmentVisible = false; private static ProfileStore convertedProfile = null; private static String convertedProfileName = null; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java index db22677a82..61bff582a5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java @@ -27,7 +27,7 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { private static Logger log = LoggerFactory.getLogger(LocalProfilePlugin.class); private boolean fragmentEnabled = false; - private boolean fragmentVisible = true; + private boolean fragmentVisible = false; private ProfileStore convertedProfile = null; private String convertedProfileName = null; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java index 45acae2e99..8f38cecb92 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java @@ -33,7 +33,7 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface { } private boolean fragmentEnabled = false; - private boolean fragmentVisible = true; + private boolean fragmentVisible = false; private static ProfileStore convertedProfile = null; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java index 9f0e7b7b74..67c497a06d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java @@ -64,7 +64,7 @@ public class SmsCommunicatorPlugin implements PluginBase { } private boolean fragmentEnabled = false; - private boolean fragmentVisible = true; + private boolean fragmentVisible = false; private final long CONFIRM_TIMEOUT = 5 * 60 * 1000L;