diff options
author | George Lin <giolin@google.com> | 2023-10-17 21:14:06 +0000 |
---|---|---|
committer | George Lin <giolin@google.com> | 2023-10-24 14:58:17 +0000 |
commit | a5b2679b1140bd136a5b7277bfc281032087060b (patch) | |
tree | d5836fa24f58645b6dac2f21424fc94c24b7fb88 /src/com | |
parent | bdd9783e4cf02a9e95854fb7a7fddb06ab638ac3 (diff) | |
download | ThemePicker-a5b2679b1140bd136a5b7277bfc281032087060b.tar.gz |
Clean up code (1/2)
We clean up the unused darkModeSnapshotRestorer, because this is no
longer used in the section views on the main surface.
When moving the dark mode toggle from the section view to the color
settings screen, we missed to also remove the unused dark mode
restorer.
Make sure we use application context instead of Activity
Test: Build success
Fixes: 306018743
Flag: NONE
Change-Id: I2924737625ae17576fa2681268e331a19b9a228d
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/customization/module/DefaultCustomizationSections.java | 4 | ||||
-rw-r--r-- | src/com/android/customization/module/ThemePickerInjector.kt | 22 |
2 files changed, 12 insertions, 14 deletions
diff --git a/src/com/android/customization/module/DefaultCustomizationSections.java b/src/com/android/customization/module/DefaultCustomizationSections.java index 460a848a..fdc2a8e1 100644 --- a/src/com/android/customization/module/DefaultCustomizationSections.java +++ b/src/com/android/customization/module/DefaultCustomizationSections.java @@ -9,7 +9,6 @@ import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.ViewModelProvider; import com.android.customization.model.grid.GridOptionsManager; -import com.android.customization.model.mode.DarkModeSnapshotRestorer; import com.android.customization.model.themedicon.ThemedIconSectionController; import com.android.customization.model.themedicon.ThemedIconSwitchProvider; import com.android.customization.model.themedicon.domain.interactor.ThemedIconInteractor; @@ -54,7 +53,6 @@ public final class DefaultCustomizationSections implements CustomizationSections private final BaseFlags mFlags; private final ClockCarouselViewModel.Factory mClockCarouselViewModelFactory; private final ClockViewFactory mClockViewFactory; - private final DarkModeSnapshotRestorer mDarkModeSnapshotRestorer; private final ThemedIconSnapshotRestorer mThemedIconSnapshotRestorer; private final ThemedIconInteractor mThemedIconInteractor; private final ColorPickerInteractor mColorPickerInteractor; @@ -67,7 +65,6 @@ public final class DefaultCustomizationSections implements CustomizationSections BaseFlags flags, ClockCarouselViewModel.Factory clockCarouselViewModelFactory, ClockViewFactory clockViewFactory, - DarkModeSnapshotRestorer darkModeSnapshotRestorer, ThemedIconSnapshotRestorer themedIconSnapshotRestorer, ThemedIconInteractor themedIconInteractor, ColorPickerInteractor colorPickerInteractor) { @@ -78,7 +75,6 @@ public final class DefaultCustomizationSections implements CustomizationSections mFlags = flags; mClockCarouselViewModelFactory = clockCarouselViewModelFactory; mClockViewFactory = clockViewFactory; - mDarkModeSnapshotRestorer = darkModeSnapshotRestorer; mThemedIconSnapshotRestorer = themedIconSnapshotRestorer; mThemedIconInteractor = themedIconInteractor; mColorPickerInteractor = colorPickerInteractor; diff --git a/src/com/android/customization/module/ThemePickerInjector.kt b/src/com/android/customization/module/ThemePickerInjector.kt index 74e28b2e..3ec7753f 100644 --- a/src/com/android/customization/module/ThemePickerInjector.kt +++ b/src/com/android/customization/module/ThemePickerInjector.kt @@ -124,27 +124,29 @@ internal constructor( private var clockRegistryProvider: ClockRegistryProvider? = null override fun getCustomizationSections(activity: ComponentActivity): CustomizationSections { + val appContext = activity.applicationContext + val clockViewFactory = getClockViewFactory(activity) + val resources = activity.resources return customizationSections ?: DefaultCustomizationSections( getColorPickerViewModelFactory( - context = activity, + context = appContext, wallpaperColorsRepository = getWallpaperColorsRepository(), ), - getKeyguardQuickAffordancePickerViewModelFactory(activity), + getKeyguardQuickAffordancePickerViewModelFactory(appContext), NotificationSectionViewModel.Factory( - interactor = getNotificationsInteractor(activity), + interactor = getNotificationsInteractor(appContext), ), getFlags(), getClockCarouselViewModelFactory( - getClockPickerInteractor(activity.applicationContext), - getClockViewFactory(activity), - resources = activity.resources, + interactor = getClockPickerInteractor(appContext), + clockViewFactory = clockViewFactory, + resources = resources, ), - getClockViewFactory(activity), - getDarkModeSnapshotRestorer(activity), - getThemedIconSnapshotRestorer(activity), + clockViewFactory, + getThemedIconSnapshotRestorer(appContext), getThemedIconInteractor(), - getColorPickerInteractor(activity, getWallpaperColorsRepository()), + getColorPickerInteractor(appContext, getWallpaperColorsRepository()), ) .also { customizationSections = it } } |