fix exception

This commit is contained in:
Milos Kozak 2019-10-17 10:09:50 +02:00
parent dd00230e69
commit 3b1f6294a9
6 changed files with 12 additions and 13 deletions

View file

@ -23,7 +23,7 @@ import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusprogressIfRunning;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning;
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.utils.FabricPrivacy;
import io.reactivex.android.schedulers.AndroidSchedulers;
@ -101,10 +101,10 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
.subscribe(event -> statusView.setText(event.getStatus()), FabricPrivacy::logException)
);
disposable.add(RxBus.INSTANCE
.toObservable(EventDismissBolusprogressIfRunning.class)
.toObservable(EventDismissBolusProgressIfRunning.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(event -> {
if (L.isEnabled(L.UI)) log.debug("EventDismissBolusprogressIfRunning");
if (L.isEnabled(L.UI)) log.debug("EventDismissBolusProgressIfRunning");
if (BolusProgressDialog.running) dismiss();
}, FabricPrivacy::logException)
);

View file

@ -3,4 +3,4 @@ package info.nightscout.androidaps.plugins.general.overview.events
import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.events.Event
class EventDismissBolusprogressIfRunning(val result: PumpEnactResult) : Event()
class EventDismissBolusProgressIfRunning(val result: PumpEnactResult?) : Event()

View file

@ -18,7 +18,7 @@ import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusprogressIfRunning;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning;
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.general.wear.wearintegration.WatchUpdaterService;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
@ -139,7 +139,7 @@ public class WearPlugin extends PluginBase {
}, FabricPrivacy::logException
));
disposable.add(RxBus.INSTANCE
.toObservable(EventDismissBolusprogressIfRunning.class)
.toObservable(EventDismissBolusProgressIfRunning.class)
.observeOn(Schedulers.io())
.subscribe(event -> {
if (event.getResult() == null) return;

View file

@ -27,7 +27,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressHelperActivity;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusprogressIfRunning;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
@ -275,7 +275,7 @@ public class CommandQueue {
public synchronized void cancelAllBoluses() {
if (!isRunning(Command.CommandType.BOLUS)) {
RxBus.INSTANCE.send(new EventDismissBolusprogressIfRunning(new PumpEnactResult().success(true).enacted(false)));
RxBus.INSTANCE.send(new EventDismissBolusProgressIfRunning(new PumpEnactResult().success(true).enacted(false)));
}
removeAll(Command.CommandType.BOLUS);
removeAll(Command.CommandType.SMB_BOLUS);

View file

@ -16,7 +16,7 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusprogressIfRunning;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning;
import info.nightscout.androidaps.queue.events.EventQueueChanged;
import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.T;
@ -68,7 +68,7 @@ public class QueueThread extends Thread {
long secondsElapsed = (System.currentTimeMillis() - connectionStartTime) / 1000;
if (!pump.isConnected() && secondsElapsed > Constants.PUMP_MAX_CONNECTION_TIME_IN_SECONDS) {
RxBus.INSTANCE.send(new EventDismissBolusprogressIfRunning(null));
RxBus.INSTANCE.send(new EventDismissBolusProgressIfRunning(null));
RxBus.INSTANCE.send(new EventPumpStatusChanged(MainApp.gs(R.string.connectiontimedout)));
if (L.isEnabled(L.PUMPQUEUE))
log.debug("timed out");

View file

@ -3,14 +3,13 @@ package info.nightscout.androidaps.queue.commands;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.general.overview.dialogs.BolusProgressDialog;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusprogressIfRunning;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.DecimalFormatter;
@ -34,7 +33,7 @@ public class CommandBolus extends Command {
PumpEnactResult r = ConfigBuilderPlugin.getPlugin().getActivePump().deliverTreatment(detailedBolusInfo);
BolusProgressDialog.bolusEnded = true;
RxBus.INSTANCE.send(new EventDismissBolusprogressIfRunning(r));
RxBus.INSTANCE.send(new EventDismissBolusProgressIfRunning(r));
if (L.isEnabled(L.PUMPQUEUE))
log.debug("Result success: " + r.success + " enacted: " + r.enacted);