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

Commit a84a36c0 authored by Zekan Qian's avatar Zekan Qian Committed by Android (Google) Code Review
Browse files

Merge "Add context in SpaEnvironment"

parents 0b9afd91 a7478a31
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) }