fix virtual pump crash
This commit is contained in:
parent
a24cbfda50
commit
d2a5939ce3
|
@ -57,7 +57,6 @@ public class VirtualPumpFragment extends SubscriberFragment {
|
|||
batteryView = (TextView) view.findViewById(R.id.virtualpump_battery);
|
||||
reservoirView = (TextView) view.findViewById(R.id.virtualpump_reservoir);
|
||||
|
||||
updateGUI();
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -66,6 +65,12 @@ public class VirtualPumpFragment extends SubscriberFragment {
|
|||
updateGUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
|
@ -73,8 +78,8 @@ public class VirtualPumpFragment extends SubscriberFragment {
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
basaBasalRateView.setText(VirtualPumpPlugin.getInstance().getBaseBasalRate() + "U");
|
||||
VirtualPumpPlugin virtualPump = VirtualPumpPlugin.getInstance();
|
||||
basaBasalRateView.setText(virtualPump.getBaseBasalRate() + "U");
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
|
||||
tempBasalView.setText(MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()).toStringFull());
|
||||
} else {
|
||||
|
@ -85,8 +90,8 @@ public class VirtualPumpFragment extends SubscriberFragment {
|
|||
} else {
|
||||
extendedBolusView.setText("");
|
||||
}
|
||||
batteryView.setText(VirtualPumpPlugin.getInstance().batteryPercent + "%");
|
||||
reservoirView.setText(VirtualPumpPlugin.getInstance().reservoirInUnits + "U");
|
||||
batteryView.setText(virtualPump.batteryPercent + "%");
|
||||
reservoirView.setText(virtualPump.reservoirInUnits + "U");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -204,7 +204,11 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
|||
|
||||
@Override
|
||||
public double getBaseBasalRate() {
|
||||
return MainApp.getConfigBuilder().getProfile().getBasal();
|
||||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
if (profile != null)
|
||||
return profile.getBasal();
|
||||
else
|
||||
return 0d;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue