Insight: simplify code
This commit is contained in:
parent
1c94a20a5c
commit
9d5afe30cb
|
@ -1173,7 +1173,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
aapsLogger.error("Exception while reading history", e);
|
aapsLogger.error("Exception while reading history", e);
|
||||||
}
|
}
|
||||||
new Handler(Looper.getMainLooper()).post(() -> rxBus.send(new EventRefreshOverview("LocalInsightPlugin::readHistory", false)));
|
rxBus.send(new EventRefreshOverview("LocalInsightPlugin::readHistory", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processHistoryEvents(String serial, List<HistoryEvent> historyEvents) {
|
private void processHistoryEvents(String serial, List<HistoryEvent> historyEvents) {
|
||||||
|
@ -1612,7 +1612,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
|
||||||
public void onStateChanged(InsightState state) {
|
public void onStateChanged(InsightState state) {
|
||||||
if (state == InsightState.CONNECTED) {
|
if (state == InsightState.CONNECTED) {
|
||||||
statusLoaded = false;
|
statusLoaded = false;
|
||||||
new Handler(Looper.getMainLooper()).post(() -> rxBus.send(new EventDismissNotification(Notification.INSIGHT_TIMEOUT_DURING_HANDSHAKE)));
|
rxBus.send(new EventDismissNotification(Notification.INSIGHT_TIMEOUT_DURING_HANDSHAKE));
|
||||||
} else if (state == InsightState.NOT_PAIRED) {
|
} else if (state == InsightState.NOT_PAIRED) {
|
||||||
connectionService.withdrawConnectionRequest(this);
|
connectionService.withdrawConnectionRequest(this);
|
||||||
statusLoaded = false;
|
statusLoaded = false;
|
||||||
|
@ -1625,9 +1625,9 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
|
||||||
activeTBR = null;
|
activeTBR = null;
|
||||||
activeBoluses = null;
|
activeBoluses = null;
|
||||||
tbrOverNotificationBlock = null;
|
tbrOverNotificationBlock = null;
|
||||||
new Handler(Looper.getMainLooper()).post(() -> rxBus.send(new EventRefreshOverview("LocalInsightPlugin::onStateChanged", false)));
|
rxBus.send(new EventRefreshOverview("LocalInsightPlugin::onStateChanged", false));
|
||||||
}
|
}
|
||||||
new Handler(Looper.getMainLooper()).post(() -> rxBus.send(new EventLocalInsightUpdateGUI()));
|
rxBus.send(new EventLocalInsightUpdateGUI());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1638,7 +1638,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
|
||||||
@Override
|
@Override
|
||||||
public void onTimeoutDuringHandshake() {
|
public void onTimeoutDuringHandshake() {
|
||||||
Notification notification = new Notification(Notification.INSIGHT_TIMEOUT_DURING_HANDSHAKE, rh.gs(R.string.timeout_during_handshake), Notification.URGENT);
|
Notification notification = new Notification(Notification.INSIGHT_TIMEOUT_DURING_HANDSHAKE, rh.gs(R.string.timeout_during_handshake), Notification.URGENT);
|
||||||
new Handler(Looper.getMainLooper()).post(() -> rxBus.send(new EventNewNotification(notification)));
|
rxBus.send(new EventNewNotification(notification));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -282,7 +282,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
if (handlerThread == null) {
|
if (handlerThread == null) {
|
||||||
handlerThread = new HandlerThread(OmnipodErosPumpPlugin.class.getSimpleName());
|
handlerThread = new HandlerThread(OmnipodErosPumpPlugin.class.getSimpleName() + "Handler");
|
||||||
handlerThread.start();
|
handlerThread.start();
|
||||||
loopHandler = new Handler(handlerThread.getLooper());
|
loopHandler = new Handler(handlerThread.getLooper());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue