fix some crashes
This commit is contained in:
parent
b711648bee
commit
ff2e9a82bc
4 changed files with 22 additions and 10 deletions
|
@ -188,11 +188,13 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
// PluginBase.APS
|
// PluginBase.APS
|
||||||
pluginsInCategory = MainApp.getSpecificPluginsListByInterface(APSInterface.class);
|
pluginsInCategory = MainApp.getSpecificPluginsListByInterface(APSInterface.class);
|
||||||
activeAPS = (APSInterface) getTheOneEnabledInArray(pluginsInCategory, PluginBase.APS);
|
activeAPS = (APSInterface) getTheOneEnabledInArray(pluginsInCategory, PluginBase.APS);
|
||||||
if (Config.logConfigBuilder)
|
if (activeAPS != null) {
|
||||||
log.debug("Selected APS interface: " + ((PluginBase) activeAPS).getName());
|
if (Config.logConfigBuilder)
|
||||||
for (PluginBase p : pluginsInCategory) {
|
log.debug("Selected APS interface: " + ((PluginBase) activeAPS).getName());
|
||||||
if (!p.getName().equals(((PluginBase) activeAPS).getName())) {
|
for (PluginBase p : pluginsInCategory) {
|
||||||
p.setFragmentVisible(PluginBase.APS, false);
|
if (!p.getName().equals(((PluginBase) activeAPS).getName())) {
|
||||||
|
p.setFragmentVisible(PluginBase.APS, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
|
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
|
import info.nightscout.utils.SafeParse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 05.08.2016.
|
* Created by mike on 05.08.2016.
|
||||||
|
@ -196,12 +197,12 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface {
|
||||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||||
for (int num = 0; num < objectives.size(); num++) {
|
for (int num = 0; num < objectives.size(); num++) {
|
||||||
Objective o = objectives.get(num);
|
Objective o = objectives.get(num);
|
||||||
o.started = new Date(settings.getLong("Objectives" + num + "started", 0));
|
o.started = new Date(SafeParse.stringToLong(settings.getString("Objectives" + num + "started", "0")));
|
||||||
o.accomplished = new Date(settings.getLong("Objectives" + num + "accomplished", 0));
|
o.accomplished = new Date(SafeParse.stringToLong(settings.getString("Objectives" + num + "accomplished", "0")));
|
||||||
}
|
}
|
||||||
bgIsAvailableInNS = settings.getBoolean("Objectives" + "bgIsAvailableInNS", false);
|
bgIsAvailableInNS = settings.getBoolean("Objectives" + "bgIsAvailableInNS", false);
|
||||||
pumpStatusIsAvailableInNS = settings.getBoolean("Objectives" + "pumpStatusIsAvailableInNS", false);
|
pumpStatusIsAvailableInNS = settings.getBoolean("Objectives" + "pumpStatusIsAvailableInNS", false);
|
||||||
manualEnacts = settings.getInt("Objectives" + "manualEnacts", 0);
|
manualEnacts = SafeParse.stringToInt(settings.getString("Objectives" + "manualEnacts", "0"));
|
||||||
if (Config.logPrefsChange)
|
if (Config.logPrefsChange)
|
||||||
log.debug("Objectives loaded");
|
log.debug("Objectives loaded");
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,4 +23,14 @@ public class SafeParse {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Long stringToLong(String input) {
|
||||||
|
Long result = 0L;
|
||||||
|
input = input.replace(",", ".");
|
||||||
|
try {
|
||||||
|
result = Long.parseLong(input);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Enable fake time and progress"
|
android:text="Enable fake time and progress"
|
||||||
android:id="@+id/objectives_fake"
|
android:id="@+id/objectives_fake" />
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/objectives_recyclerview"
|
android:id="@+id/objectives_recyclerview"
|
||||||
|
|
Loading…
Reference in a new issue