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