diff --git a/app/src/main/java/org/mozilla/fenix/utils/AdapterWithJob.kt b/app/src/main/java/org/mozilla/fenix/utils/AdapterWithJob.kt index 6417ade33..ae91db6a7 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/AdapterWithJob.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/AdapterWithJob.kt @@ -11,15 +11,10 @@ import kotlinx.coroutines.Job /** * [RecyclerView.Adapter] with a [Job] for coroutines. - * The adapterJob is setup when the adapter is attached to a RecyclerView and canceled when detached. + * The adapterJob is setup when the adapter is initialized to a RecyclerView and canceled when detached. */ abstract class AdapterWithJob : RecyclerView.Adapter() { - protected lateinit var adapterJob: Job - - override fun onAttachedToRecyclerView(recyclerView: RecyclerView) { - super.onAttachedToRecyclerView(recyclerView) - adapterJob = Job() - } + protected var adapterJob: Job = Job() override fun onDetachedFromRecyclerView(recyclerView: RecyclerView) { super.onDetachedFromRecyclerView(recyclerView) @@ -29,17 +24,12 @@ abstract class AdapterWithJob : RecyclerView.Adapt /** * [ListAdapter] with a [Job] for coroutines. - * The adapterJob is setup when the adapter is attached to a RecyclerView and canceled when detached. + * The adapterJob is setup when the adapter is initialized to a RecyclerView and canceled when detached. */ abstract class ListAdapterWithJob( diffCallback: DiffUtil.ItemCallback ) : ListAdapter(diffCallback) { - protected lateinit var adapterJob: Job - - override fun onAttachedToRecyclerView(recyclerView: RecyclerView) { - super.onAttachedToRecyclerView(recyclerView) - adapterJob = Job() - } + protected var adapterJob: Job = Job() override fun onDetachedFromRecyclerView(recyclerView: RecyclerView) { super.onDetachedFromRecyclerView(recyclerView) diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml index 0214e623f..b49a8e739 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.xml @@ -405,7 +405,6 @@