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

Commit a5b2679b authored by George Lin's avatar George Lin
Browse files

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
parent bdd9783e
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -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;
+12 −10
Original line number Diff line number Diff line
@@ -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 }
    }