catch errors on load profile
This commit is contained in:
parent
cf65b3f865
commit
777b6cdb0d
1 changed files with 52 additions and 16 deletions
|
@ -90,13 +90,13 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
|||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putBoolean("SimpleProfile" + "mmol", mmol);
|
||||
editor.putBoolean("SimpleProfile" + "mgdl", mgdl);
|
||||
editor.putFloat("SimpleProfile" + "dia", new Float(dia));
|
||||
editor.putFloat("SimpleProfile" + "ic", new Float(ic));
|
||||
editor.putFloat("SimpleProfile" + "isf", new Float(isf));
|
||||
editor.putFloat("SimpleProfile" + "car", new Float(car));
|
||||
editor.putFloat("SimpleProfile" + "basal", new Float(basal));
|
||||
editor.putFloat("SimpleProfile" + "targetlow", new Float(targetLow));
|
||||
editor.putFloat("SimpleProfile" + "targethigh", new Float(targetHigh));
|
||||
editor.putString("SimpleProfile" + "dia", dia.toString());
|
||||
editor.putString("SimpleProfile" + "ic", ic.toString());
|
||||
editor.putString("SimpleProfile" + "isf", isf.toString());
|
||||
editor.putString("SimpleProfile" + "car", car.toString());
|
||||
editor.putString("SimpleProfile" + "basal", basal.toString());
|
||||
editor.putString("SimpleProfile" + "targetlow", targetLow.toString());
|
||||
editor.putString("SimpleProfile" + "targethigh", targetHigh.toString());
|
||||
|
||||
editor.commit();
|
||||
createConvertedProfile();
|
||||
|
@ -108,31 +108,67 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
|||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||
|
||||
if (settings.contains("SimpleProfile" + "mgdl"))
|
||||
try {
|
||||
mgdl = settings.getBoolean("SimpleProfile" + "mgdl", true);
|
||||
} catch (Exception e) {
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
else mgdl = true;
|
||||
if (settings.contains("SimpleProfile" + "mmol"))
|
||||
try {
|
||||
mmol = settings.getBoolean("SimpleProfile" + "mmol", false);
|
||||
} catch (Exception e) {
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
else mmol = false;
|
||||
if (settings.contains("SimpleProfile" + "dia"))
|
||||
try {
|
||||
dia = SafeParse.stringToDouble(settings.getString("SimpleProfile" + "dia", "3"));
|
||||
} catch (Exception e) {
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
else dia = 3d;
|
||||
if (settings.contains("SimpleProfile" + "ic"))
|
||||
try {
|
||||
ic = SafeParse.stringToDouble(settings.getString("SimpleProfile" + "ic", "20"));
|
||||
} catch (Exception e) {
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
else ic = 20d;
|
||||
if (settings.contains("SimpleProfile" + "isf"))
|
||||
try {
|
||||
isf = SafeParse.stringToDouble(settings.getString("SimpleProfile" + "isf", "200"));
|
||||
} catch (Exception e) {
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
else isf = 200d;
|
||||
if (settings.contains("SimpleProfile" + "car"))
|
||||
try {
|
||||
car = SafeParse.stringToDouble(settings.getString("SimpleProfile" + "car", "20"));
|
||||
} catch (Exception e) {
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
else car = 20d;
|
||||
if (settings.contains("SimpleProfile" + "basal"))
|
||||
try {
|
||||
basal = SafeParse.stringToDouble(settings.getString("SimpleProfile" + "basal", "1"));
|
||||
} catch (Exception e) {
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
else basal = 1d;
|
||||
if (settings.contains("SimpleProfile" + "targetlow"))
|
||||
try {
|
||||
targetLow = SafeParse.stringToDouble(settings.getString("SimpleProfile" + "targetlow", "80"));
|
||||
} catch (Exception e) {
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
else targetLow = 80d;
|
||||
if (settings.contains("SimpleProfile" + "targethigh"))
|
||||
try {
|
||||
targetHigh = SafeParse.stringToDouble(settings.getString("SimpleProfile" + "targethigh", "120"));
|
||||
} catch (Exception e) {
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
else targetHigh = 120d;
|
||||
createConvertedProfile();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue