Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a7478a31 authored by Zekan Qian's avatar Zekan Qian
Browse files

Add context in SpaEnvironment

Bug: 244122804
Test: manual - build gallery
Change-Id: I0851a3dfc2acb0e5f06761f74e555da912d71900
parent 1328cadf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,6 +22,6 @@ import com.android.settingslib.spa.framework.common.SpaEnvironmentFactory
class GalleryApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        SpaEnvironmentFactory.reset(GallerySpaEnvironment)
        SpaEnvironmentFactory.reset(GallerySpaEnvironment(this))
    }
}
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.settingslib.spa.gallery

import android.content.Context
import com.android.settingslib.spa.framework.common.LocalLogger
import com.android.settingslib.spa.framework.common.SettingsPageProviderRepository
import com.android.settingslib.spa.framework.common.SpaEnvironment
@@ -49,7 +50,7 @@ enum class SettingsPageProviderEnum(val displayName: String) {
    // Add your SPPs
}

object GallerySpaEnvironment : SpaEnvironment() {
class GallerySpaEnvironment(context: Context) : SpaEnvironment(context) {
    override val pageProviderRepository = lazy {
        SettingsPageProviderRepository(
            allPageProviders = listOf(
+2 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.settingslib.spa.framework.common

import android.app.Activity
import android.content.Context
import android.util.Log

private const val TAG = "SpaEnvironment"
@@ -37,7 +38,7 @@ object SpaEnvironmentFactory {
        }
}

abstract class SpaEnvironment {
abstract class SpaEnvironment(val context: Context) {
    abstract val pageProviderRepository: Lazy<SettingsPageProviderRepository>

    val entryRepository = lazy { SettingsEntryRepository(pageProviderRepository.value) }