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 5315910899..ec9c6d1e40 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 @@ -162,9 +162,6 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte baseic[i] = SP.getDouble(SETTINGS_PREFIX + "baseic" + i, baseic[i]); baseisf[i] = SP.getDouble(SETTINGS_PREFIX + "baseisf" + i, baseisf[i]); } - - - createConvertedProfile(); } public String externallySetParameters(int timeshift, int percentage) { @@ -347,6 +344,9 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte @Override public ProfileStore getProfile() { + if (convertedProfile == null) + createConvertedProfile(); + performLimitCheck(); return convertedProfile; } @@ -358,6 +358,9 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte @Override public String getProfileName() { + if (convertedProfile == null) + createConvertedProfile(); + performLimitCheck(); return convertedProfileName; } 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 b9780d7493..b13945ae03 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 @@ -178,7 +178,6 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { } catch (JSONException ignored) { } } - createConvertedProfile(); } /* @@ -244,6 +243,8 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { @Override public ProfileStore getProfile() { + if (convertedProfile == null) + createConvertedProfile(); return convertedProfile; } @@ -254,6 +255,8 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface { @Override public String getProfileName() { + if (convertedProfile == null) + createConvertedProfile(); return DecimalFormatter.to2Decimal(convertedProfile.getDefaultProfile().percentageBasalSum()) + "U "; } 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 d0b36d34ca..fbc9cf6b4c 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 @@ -13,9 +13,9 @@ import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.data.ProfileStore; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.ProfileInterface; -import info.nightscout.androidaps.data.ProfileStore; import info.nightscout.utils.SP; /** @@ -28,7 +28,7 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface { public static SimpleProfilePlugin getPlugin() { if (simpleProfilePlugin == null) - simpleProfilePlugin = new SimpleProfilePlugin(); + simpleProfilePlugin = new SimpleProfilePlugin(); return simpleProfilePlugin; } @@ -146,7 +146,6 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface { basal = SP.getDouble("SimpleProfile" + "basal", 1d); targetLow = SP.getDouble("SimpleProfile" + "targetlow", 80d); targetHigh = SP.getDouble("SimpleProfile" + "targethigh", 120d); - createConvertedProfile(); } /* @@ -211,6 +210,8 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface { @Override public ProfileStore getProfile() { + if (convertedProfile == null) + createConvertedProfile(); return convertedProfile; }