HistoryBrowser fix

This commit is contained in:
Milos Kozak 2020-05-13 00:11:48 +02:00
parent 903555ed9f
commit c03a89db16
4 changed files with 11 additions and 7 deletions

View file

@ -2,9 +2,9 @@ package info.nightscout.androidaps.historyBrowser
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
@ -15,7 +15,9 @@ import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class IobCobStaticCalculatorPlugin @Inject constructor(
injector: HasAndroidInjector,
aapsLogger: AAPSLogger,

View file

@ -814,9 +814,9 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
getAapsLogger().debug(LTag.AUTOSENS, "Starting calculation thread: " + from + " to " + dateUtil.dateAndTimeString(end));
if (thread == null || thread.getState() == Thread.State.TERMINATED) {
if (sensitivityOref1Plugin.isEnabled())
thread = new IobCobOref1Thread(injector, from, end, bgDataReload, limitDataToOldestAvailable, cause);
thread = new IobCobOref1Thread(injector, this, from, end, bgDataReload, limitDataToOldestAvailable, cause);
else
thread = new IobCobThread(injector, from, end, bgDataReload, limitDataToOldestAvailable, cause);
thread = new IobCobThread(injector, this, from, end, bgDataReload, limitDataToOldestAvailable, cause);
thread.start();
}
}

View file

@ -62,7 +62,6 @@ public class IobCobOref1Thread extends Thread {
@Inject ProfileFunction profileFunction;
@Inject Context context;
@Inject ActivePluginProvider activePluginProvider;
@Inject IobCobCalculatorPlugin iobCobCalculatorPlugin;
@Inject SensitivityAAPSPlugin sensitivityAAPSPlugin;
@Inject SensitivityWeightedAveragePlugin sensitivityWeightedAveragePlugin;
@Inject BuildHelper buildHelper;
@ -71,6 +70,7 @@ public class IobCobOref1Thread extends Thread {
@Inject DateUtil dateUtil;
private final HasAndroidInjector injector;
private final IobCobCalculatorPlugin iobCobCalculatorPlugin; // cannot be injected : HistoryBrowser uses different instance
private boolean bgDataReload;
private boolean limitDataToOldestAvailable;
private String from;
@ -78,10 +78,11 @@ public class IobCobOref1Thread extends Thread {
private PowerManager.WakeLock mWakeLock;
IobCobOref1Thread(HasAndroidInjector injector, String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
IobCobOref1Thread(HasAndroidInjector injector, IobCobCalculatorPlugin iobCobCalculatorPlugin, String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
super();
injector.androidInjector().inject(this);
this.injector = injector;
this.iobCobCalculatorPlugin = iobCobCalculatorPlugin;
this.bgDataReload = bgDataReload;
this.limitDataToOldestAvailable = limitDataToOldestAvailable;

View file

@ -59,7 +59,6 @@ public class IobCobThread extends Thread {
@Inject ProfileFunction profileFunction;
@Inject Context context;
@Inject ActivePluginProvider activePluginProvider;
@Inject IobCobCalculatorPlugin iobCobCalculatorPlugin;
@Inject SensitivityAAPSPlugin sensitivityAAPSPlugin;
@Inject SensitivityWeightedAveragePlugin sensitivityWeightedAveragePlugin;
@Inject BuildHelper buildHelper;
@ -68,6 +67,7 @@ public class IobCobThread extends Thread {
@Inject DateUtil dateUtil;
private final HasAndroidInjector injector;
private final IobCobCalculatorPlugin iobCobCalculatorPlugin; // cannot be injected : HistoryBrowser uses different instance
private boolean bgDataReload;
private boolean limitDataToOldestAvailable;
private String from;
@ -75,10 +75,11 @@ public class IobCobThread extends Thread {
private PowerManager.WakeLock mWakeLock;
@Inject IobCobThread(HasAndroidInjector injector, String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
@Inject IobCobThread(HasAndroidInjector injector, IobCobCalculatorPlugin iobCobCalculatorPlugin, String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
super();
injector.androidInjector().inject(this);
this.injector = injector;
this.iobCobCalculatorPlugin = iobCobCalculatorPlugin;
this.bgDataReload = bgDataReload;
this.limitDataToOldestAvailable = limitDataToOldestAvailable;