diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/initpod/InitActionFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/initpod/InitActionFragment.java index 7cb106ca47..29145d9e6a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/initpod/InitActionFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/initpod/InitActionFragment.java @@ -26,6 +26,8 @@ import java.util.UUID; import javax.inject.Inject; +import dagger.android.HasAndroidInjector; +import dagger.android.support.DaggerFragment; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction; @@ -35,7 +37,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver; /** * Created by andy on 12/11/2019 */ -public class InitActionFragment extends Fragment implements PodInitReceiver { +public class InitActionFragment extends DaggerFragment implements PodInitReceiver { private static final String ARG_KEY = "key"; protected PageFragmentCallbacks mCallbacks; @@ -53,6 +55,8 @@ public class InitActionFragment extends Fragment implements PodInitReceiver { protected PumpEnactResult callResult; + @Inject HasAndroidInjector injector; + public static InitActionFragment create(String key, PodInitActionType podInitActionType) { Bundle args = new Bundle(); @@ -125,7 +129,7 @@ public class InitActionFragment extends Fragment implements PodInitReceiver { } }); - new InitPodTask(instance).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + new InitPodTask(injector, instance).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }); return rootView; @@ -165,7 +169,7 @@ public class InitActionFragment extends Fragment implements PodInitReceiver { //System.out.println("ACTION: setUserVisibleHint="+ isVisibleToUser); if (isVisibleToUser) { //System.out.println("ACTION: Visible"); - new InitPodTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + new InitPodTask(injector, this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { System.out.println("ACTION: Not visible"); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/initpod/InitPodTask.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/initpod/InitPodTask.java index 32f6eabac4..d014ca09c7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/initpod/InitPodTask.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/initpod/InitPodTask.java @@ -6,6 +6,7 @@ import android.view.View; import javax.inject.Inject; +import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType; import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager; @@ -18,8 +19,8 @@ public class InitPodTask extends AsyncTask { @Inject ProfileFunction profileFunction; private InitActionFragment initActionFragment; - public InitPodTask(InitActionFragment initActionFragment) { - + public InitPodTask(HasAndroidInjector injector, InitActionFragment initActionFragment) { + injector.androidInjector().inject(this); this.initActionFragment = initActionFragment; }