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 Original line Diff line number Diff line
@@ -9,7 +9,6 @@ import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelProvider;


import com.android.customization.model.grid.GridOptionsManager;
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.ThemedIconSectionController;
import com.android.customization.model.themedicon.ThemedIconSwitchProvider;
import com.android.customization.model.themedicon.ThemedIconSwitchProvider;
import com.android.customization.model.themedicon.domain.interactor.ThemedIconInteractor;
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 BaseFlags mFlags;
    private final ClockCarouselViewModel.Factory mClockCarouselViewModelFactory;
    private final ClockCarouselViewModel.Factory mClockCarouselViewModelFactory;
    private final ClockViewFactory mClockViewFactory;
    private final ClockViewFactory mClockViewFactory;
    private final DarkModeSnapshotRestorer mDarkModeSnapshotRestorer;
    private final ThemedIconSnapshotRestorer mThemedIconSnapshotRestorer;
    private final ThemedIconSnapshotRestorer mThemedIconSnapshotRestorer;
    private final ThemedIconInteractor mThemedIconInteractor;
    private final ThemedIconInteractor mThemedIconInteractor;
    private final ColorPickerInteractor mColorPickerInteractor;
    private final ColorPickerInteractor mColorPickerInteractor;
@@ -67,7 +65,6 @@ public final class DefaultCustomizationSections implements CustomizationSections
            BaseFlags flags,
            BaseFlags flags,
            ClockCarouselViewModel.Factory clockCarouselViewModelFactory,
            ClockCarouselViewModel.Factory clockCarouselViewModelFactory,
            ClockViewFactory clockViewFactory,
            ClockViewFactory clockViewFactory,
            DarkModeSnapshotRestorer darkModeSnapshotRestorer,
            ThemedIconSnapshotRestorer themedIconSnapshotRestorer,
            ThemedIconSnapshotRestorer themedIconSnapshotRestorer,
            ThemedIconInteractor themedIconInteractor,
            ThemedIconInteractor themedIconInteractor,
            ColorPickerInteractor colorPickerInteractor) {
            ColorPickerInteractor colorPickerInteractor) {
@@ -78,7 +75,6 @@ public final class DefaultCustomizationSections implements CustomizationSections
        mFlags = flags;
        mFlags = flags;
        mClockCarouselViewModelFactory = clockCarouselViewModelFactory;
        mClockCarouselViewModelFactory = clockCarouselViewModelFactory;
        mClockViewFactory = clockViewFactory;
        mClockViewFactory = clockViewFactory;
        mDarkModeSnapshotRestorer = darkModeSnapshotRestorer;
        mThemedIconSnapshotRestorer = themedIconSnapshotRestorer;
        mThemedIconSnapshotRestorer = themedIconSnapshotRestorer;
        mThemedIconInteractor = themedIconInteractor;
        mThemedIconInteractor = themedIconInteractor;
        mColorPickerInteractor = colorPickerInteractor;
        mColorPickerInteractor = colorPickerInteractor;
+12 −10
Original line number Original line Diff line number Diff line
@@ -124,27 +124,29 @@ internal constructor(
    private var clockRegistryProvider: ClockRegistryProvider? = null
    private var clockRegistryProvider: ClockRegistryProvider? = null


    override fun getCustomizationSections(activity: ComponentActivity): CustomizationSections {
    override fun getCustomizationSections(activity: ComponentActivity): CustomizationSections {
        val appContext = activity.applicationContext
        val clockViewFactory = getClockViewFactory(activity)
        val resources = activity.resources
        return customizationSections
        return customizationSections
            ?: DefaultCustomizationSections(
            ?: DefaultCustomizationSections(
                    getColorPickerViewModelFactory(
                    getColorPickerViewModelFactory(
                        context = activity,
                        context = appContext,
                        wallpaperColorsRepository = getWallpaperColorsRepository(),
                        wallpaperColorsRepository = getWallpaperColorsRepository(),
                    ),
                    ),
                    getKeyguardQuickAffordancePickerViewModelFactory(activity),
                    getKeyguardQuickAffordancePickerViewModelFactory(appContext),
                    NotificationSectionViewModel.Factory(
                    NotificationSectionViewModel.Factory(
                        interactor = getNotificationsInteractor(activity),
                        interactor = getNotificationsInteractor(appContext),
                    ),
                    ),
                    getFlags(),
                    getFlags(),
                    getClockCarouselViewModelFactory(
                    getClockCarouselViewModelFactory(
                        getClockPickerInteractor(activity.applicationContext),
                        interactor = getClockPickerInteractor(appContext),
                        getClockViewFactory(activity),
                        clockViewFactory = clockViewFactory,
                        resources = activity.resources,
                        resources = resources,
                    ),
                    ),
                    getClockViewFactory(activity),
                    clockViewFactory,
                    getDarkModeSnapshotRestorer(activity),
                    getThemedIconSnapshotRestorer(appContext),
                    getThemedIconSnapshotRestorer(activity),
                    getThemedIconInteractor(),
                    getThemedIconInteractor(),
                    getColorPickerInteractor(activity, getWallpaperColorsRepository()),
                    getColorPickerInteractor(appContext, getWallpaperColorsRepository()),
                )
                )
                .also { customizationSections = it }
                .also { customizationSections = it }
    }
    }