- fixed some cosmetical changes

- fixed problem with initialization, now MDT is initialized at once
This commit is contained in:
Andy Rozman 2020-07-31 16:39:56 +01:00
parent 20e2bf0b06
commit 557568b353
3 changed files with 21 additions and 20 deletions

View file

@ -219,7 +219,7 @@ class OmnipodFragment : DaggerFragment() {
omnipodPumpStatus.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId) omnipodPumpStatus.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId)
omnipodPumpStatus.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId) omnipodPumpStatus.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId) omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice.MedtronicPump)) omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId) else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
} }
omnipod_rl_status.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE) omnipod_rl_status.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE)

View file

@ -16,6 +16,7 @@ import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.MedtronicHistoryActivity import info.nightscout.androidaps.plugins.pump.medtronic.dialog.MedtronicHistoryActivity
@ -46,7 +47,6 @@ import javax.inject.Inject
class MedtronicFragment : DaggerFragment() { class MedtronicFragment : DaggerFragment() {
@Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var aapsLogger: AAPSLogger
//@Inject lateinit var mainApp: MainApp
@Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var rxBus: RxBusWrapper
@ -179,7 +179,7 @@ class MedtronicFragment : DaggerFragment() {
rileyLinkServiceData.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId) rileyLinkServiceData.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId)
rileyLinkServiceData.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId) rileyLinkServiceData.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId) rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice.MedtronicPump)) rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId) else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
} }
medtronic_rl_status.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE) medtronic_rl_status.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE)
@ -191,15 +191,15 @@ class MedtronicFragment : DaggerFragment() {
when (medtronicPumpStatus.pumpDeviceState) { when (medtronicPumpStatus.pumpDeviceState) {
null, null,
info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState.Sleeping -> medtronic_pump_status.text = "{fa-bed} " // + pumpStatus.pumpDeviceState.name()); PumpDeviceState.Sleeping -> medtronic_pump_status.text = "{fa-bed} " // + pumpStatus.pumpDeviceState.name());
info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState.NeverContacted, PumpDeviceState.NeverContacted,
info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState.WakingUp, PumpDeviceState.WakingUp,
info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState.PumpUnreachable, PumpDeviceState.PumpUnreachable,
info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState.ErrorWhenCommunicating, PumpDeviceState.ErrorWhenCommunicating,
info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState.TimeoutWhenCommunicating, PumpDeviceState.TimeoutWhenCommunicating,
info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState.InvalidConfiguration -> medtronic_pump_status.text = " " + resourceHelper.gs(medtronicPumpStatus.pumpDeviceState.resourceId) PumpDeviceState.InvalidConfiguration -> medtronic_pump_status.text = " " + resourceHelper.gs(medtronicPumpStatus.pumpDeviceState.resourceId)
info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState.Active -> { PumpDeviceState.Active -> {
val cmd = medtronicUtil.getCurrentCommand() val cmd = medtronicUtil.getCurrentCommand()
if (cmd == null) if (cmd == null)
medtronic_pump_status.text = " " + resourceHelper.gs(medtronicPumpStatus.pumpDeviceState.resourceId) medtronic_pump_status.text = " " + resourceHelper.gs(medtronicPumpStatus.pumpDeviceState.resourceId)

View file

@ -174,6 +174,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
aapsLogger.debug(LTag.PUMP, "RileyLinkMedtronicService is connected"); aapsLogger.debug(LTag.PUMP, "RileyLinkMedtronicService is connected");
RileyLinkMedtronicService.LocalBinder mLocalBinder = (RileyLinkMedtronicService.LocalBinder) service; RileyLinkMedtronicService.LocalBinder mLocalBinder = (RileyLinkMedtronicService.LocalBinder) service;
rileyLinkMedtronicService = mLocalBinder.getServiceInstance(); rileyLinkMedtronicService = mLocalBinder.getServiceInstance();
rileyLinkMedtronicService.verifyConfiguration();
new Thread(() -> { new Thread(() -> {
@ -217,7 +218,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
medtronicPumpStatus.lastDataTime = medtronicPumpStatus.lastConnection; medtronicPumpStatus.lastDataTime = medtronicPumpStatus.lastConnection;
medtronicPumpStatus.previousConnection = medtronicPumpStatus.lastConnection; medtronicPumpStatus.previousConnection = medtronicPumpStatus.lastConnection;
if (rileyLinkMedtronicService != null) rileyLinkMedtronicService.verifyConfiguration(); //if (rileyLinkMedtronicService != null) rileyLinkMedtronicService.verifyConfiguration();
aapsLogger.debug(LTag.PUMP, "initPumpStatusData: " + this.medtronicPumpStatus); aapsLogger.debug(LTag.PUMP, "initPumpStatusData: " + this.medtronicPumpStatus);