remove some dependencies

This commit is contained in:
Milos Kozak 2020-03-31 21:54:49 +02:00
parent 5b539fd906
commit 56d0d2850d
5 changed files with 15 additions and 29 deletions

View file

@ -37,6 +37,7 @@ import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.queue.events.EventQueueChanged import info.nightscout.androidaps.queue.events.EventQueueChanged
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.OKDialog
import info.nightscout.androidaps.utils.SetWarnColor import info.nightscout.androidaps.utils.SetWarnColor
import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.extensions.plusAssign import info.nightscout.androidaps.utils.extensions.plusAssign
@ -86,13 +87,13 @@ class MedtronicFragment : DaggerFragment() {
if (MedtronicUtil.getPumpStatus().verifyConfiguration()) { if (MedtronicUtil.getPumpStatus().verifyConfiguration()) {
startActivity(Intent(context, MedtronicHistoryActivity::class.java)) startActivity(Intent(context, MedtronicHistoryActivity::class.java))
} else { } else {
MedtronicUtil.displayNotConfiguredDialog(context) displayNotConfiguredDialog()
} }
} }
medtronic_refresh.setOnClickListener { medtronic_refresh.setOnClickListener {
if (!MedtronicUtil.getPumpStatus().verifyConfiguration()) { if (!MedtronicUtil.getPumpStatus().verifyConfiguration()) {
MedtronicUtil.displayNotConfiguredDialog(context) displayNotConfiguredDialog()
} else { } else {
medtronic_refresh.isEnabled = false medtronic_refresh.isEnabled = false
medtronicPumpPlugin.resetStatusState() medtronicPumpPlugin.resetStatusState()
@ -108,7 +109,7 @@ class MedtronicFragment : DaggerFragment() {
if (MedtronicUtil.getPumpStatus().verifyConfiguration()) { if (MedtronicUtil.getPumpStatus().verifyConfiguration()) {
startActivity(Intent(context, RileyLinkStatusActivity::class.java)) startActivity(Intent(context, RileyLinkStatusActivity::class.java))
} else { } else {
MedtronicUtil.displayNotConfiguredDialog(context) displayNotConfiguredDialog()
} }
} }
} }
@ -247,6 +248,13 @@ class MedtronicFragment : DaggerFragment() {
} }
} }
private fun displayNotConfiguredDialog() {
context?.let {
OKDialog.show(it, resourceHelper.gs(R.string.combo_warning),
resourceHelper.gs(R.string.medtronic_error_operation_not_possible_no_configuration), null)
}
}
// GUI functions // GUI functions
@Synchronized @Synchronized
fun updateGUI() { fun updateGUI() {

View file

@ -1,7 +1,6 @@
package info.nightscout.androidaps.plugins.pump.medtronic.comm.ui; package info.nightscout.androidaps.plugins.pump.medtronic.comm.ui;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.L;
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.hw.rileylink.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
@ -43,7 +42,6 @@ public class MedtronicUIComm {
public synchronized MedtronicUITask executeCommand(MedtronicCommandType commandType, Object... parameters) { public synchronized MedtronicUITask executeCommand(MedtronicCommandType commandType, Object... parameters) {
if (isLogEnabled())
aapsLogger.warn(LTag.PUMP, "Execute Command: " + commandType.name()); aapsLogger.warn(LTag.PUMP, "Execute Command: " + commandType.name());
MedtronicUITask task = new MedtronicUITask(commandType, parameters); MedtronicUITask task = new MedtronicUITask(commandType, parameters);
@ -78,7 +76,7 @@ public class MedtronicUIComm {
// } // }
// } // }
if (!task.isReceived() && isLogEnabled()) { if (!task.isReceived()) {
aapsLogger.warn(LTag.PUMP, "Reply not received for " + commandType); aapsLogger.warn(LTag.PUMP, "Reply not received for " + commandType);
} }
@ -112,9 +110,4 @@ public class MedtronicUIComm {
public void startTunning() { public void startTunning() {
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump); RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump);
} }
private boolean isLogEnabled() {
return L.isEnabled(L.PUMP);
}
} }

View file

@ -64,11 +64,6 @@ public class RileyLinkMedtronicService extends RileyLinkService {
} }
public static MedtronicCommunicationManager getCommunicationManager() {
return instance.medtronicCommunicationManager;
}
@Override @Override
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
aapsLogger.warn(LTag.PUMPCOMM, "onConfigurationChanged"); aapsLogger.warn(LTag.PUMPCOMM, "onConfigurationChanged");

View file

@ -1,13 +1,10 @@
package info.nightscout.androidaps.plugins.pump.medtronic.util; package info.nightscout.androidaps.plugins.pump.medtronic.util;
import android.content.Context;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import org.joda.time.LocalTime; import org.joda.time.LocalTime;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
@ -15,8 +12,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
@ -41,7 +36,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus; import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService; import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService;
import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper;
/** /**
@ -532,9 +526,4 @@ public class MedtronicUtil extends RileyLinkUtil {
} }
public static void displayNotConfiguredDialog(Context context) {
OKDialog.show(context, MainApp.gs(R.string.combo_warning),
MainApp.gs(R.string.medtronic_error_operation_not_possible_no_configuration), null);
}
} }

View file

@ -54,6 +54,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult;
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData; import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
@ -571,7 +572,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
// return true if new record is created // return true if new record is created
@Override @Override
public boolean addToHistoryTreatment(DetailedBolusInfo detailedBolusInfo, boolean allowUpdate) { public boolean addToHistoryTreatment(DetailedBolusInfo detailedBolusInfo, boolean allowUpdate) {
boolean medtronicPump = MedtronicUtil.isMedtronicPump(); boolean medtronicPump = activePlugin.getActivePump() instanceof MedtronicPumpPlugin;
getAapsLogger().debug(MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: addToHistoryTreatment::isMedtronicPump={} " + medtronicPump); getAapsLogger().debug(MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: addToHistoryTreatment::isMedtronicPump={} " + medtronicPump);