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

Commit 3cf026e7 authored by Chaohui Wang's avatar Chaohui Wang Committed by Android (Google) Code Review
Browse files

Merge "Create SpaEnvironment"

parents cac91505 1040882f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ buildscript {
    }
}
plugins {
    id 'com.android.application' version '7.3.0-rc01' apply false
    id 'com.android.library' version '7.3.0-rc01' apply false
    id 'com.android.application' version '7.3.0' apply false
    id 'com.android.library' version '7.3.0' apply false
    id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
+1 −5
Original line number Diff line number Diff line
@@ -18,8 +18,4 @@ package com.android.settingslib.spa.gallery

import com.android.settingslib.spa.framework.DebugActivity

class GalleryDebugActivity : DebugActivity(
    SpaEnvironment.EntryRepository,
    browseActivityClass = MainActivity::class.java,
    entryProviderAuthorities = "com.android.spa.gallery.provider",
)
class GalleryDebugActivity : DebugActivity(GallerySpaEnvironment)
+1 −4
Original line number Diff line number Diff line
@@ -18,7 +18,4 @@ package com.android.settingslib.spa.gallery

import com.android.settingslib.spa.framework.EntryProvider

class GalleryEntryProvider : EntryProvider(
    SpaEnvironment.EntryRepository,
    browseActivityClass = MainActivity::class.java,
)
class GalleryEntryProvider : EntryProvider(GallerySpaEnvironment)
+5 −8
Original line number Diff line number Diff line
@@ -18,9 +18,9 @@ package com.android.settingslib.spa.gallery

import android.os.Bundle
import androidx.navigation.NamedNavArgument
import com.android.settingslib.spa.framework.common.SettingsEntryRepository
import com.android.settingslib.spa.framework.common.SettingsPage
import com.android.settingslib.spa.framework.common.SettingsPageProviderRepository
import com.android.settingslib.spa.framework.common.SpaEnvironment
import com.android.settingslib.spa.gallery.button.ActionButtonPageProvider
import com.android.settingslib.spa.gallery.home.HomePageProvider
import com.android.settingslib.spa.gallery.page.ArgumentPageProvider
@@ -62,9 +62,8 @@ fun createSettingsPage(
    )
}

object SpaEnvironment {
    val PageProviderRepository: SettingsPageProviderRepository by
    lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
object GallerySpaEnvironment : SpaEnvironment() {
    override val pageProviderRepository = lazy {
        SettingsPageProviderRepository(
            allPageProviders = listOf(
                HomePageProvider,
@@ -88,9 +87,7 @@ object SpaEnvironment {
        )
    }

    val EntryRepository: SettingsEntryRepository by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
        SettingsEntryRepository(PageProviderRepository)
    }
    override val browseActivityClass = MainActivity::class.java

    // TODO: add other environment setup here.
    override val entryProviderAuthorities = "com.android.spa.gallery.provider"
}
+1 −1
Original line number Diff line number Diff line
@@ -18,4 +18,4 @@ package com.android.settingslib.spa.gallery

import com.android.settingslib.spa.framework.BrowseActivity

class MainActivity : BrowseActivity(SpaEnvironment.PageProviderRepository)
class MainActivity : BrowseActivity(GallerySpaEnvironment)
Loading