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

Commit 420390c5 authored by Ale Nijamkin's avatar Ale Nijamkin Committed by Android (Google) Code Review
Browse files

Merge "Wallpaper quick switcher section (2/3)." into tm-qpr-dev

parents 427fc9ae 536751e4
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -25,12 +25,16 @@ import com.android.wallpaper.model.WallpaperSectionController;
import com.android.wallpaper.model.WorkspaceViewModel;
import com.android.wallpaper.module.CurrentWallpaperInfoFactory;
import com.android.wallpaper.module.CustomizationSections;
import com.android.wallpaper.picker.customization.domain.interactor.WallpaperInteractor;
import com.android.wallpaper.picker.customization.ui.section.ScreenPreviewSectionController;
import com.android.wallpaper.picker.customization.ui.section.WallpaperQuickSwitchSectionController;
import com.android.wallpaper.util.DisplayUtils;

import java.util.ArrayList;
import java.util.List;

import kotlinx.coroutines.GlobalScope;

/** {@link CustomizationSections} for the customization picker. */
public final class DefaultCustomizationSections implements CustomizationSections {

@@ -59,7 +63,8 @@ public final class DefaultCustomizationSections implements CustomizationSections
            CustomizationSectionNavigationController sectionNavigationController,
            @Nullable Bundle savedInstanceState,
            CurrentWallpaperInfoFactory wallpaperInfoFactory,
            DisplayUtils displayUtils) {
            DisplayUtils displayUtils,
            WallpaperInteractor wallpaperInteractor) {
        List<CustomizationSectionController<?>> sectionControllers = new ArrayList<>();

        // Wallpaper section.
@@ -76,6 +81,14 @@ public final class DefaultCustomizationSections implements CustomizationSections
        sectionControllers.add(new ColorSectionController(
                activity, wallpaperColorsViewModel, lifecycleOwner, savedInstanceState));

        // Wallpaper quick switch section.
        sectionControllers.add(
                new WallpaperQuickSwitchSectionController(
                        wallpaperInteractor,
                        lifecycleOwner,
                        GlobalScope.INSTANCE,
                        sectionNavigationController));

        switch (screen) {
            case LOCK_SCREEN:
                // Lock screen quick affordances section.
+5 −3
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject
        return super<WallpaperPicker2Injector>.getSnapshotRestorers(context).toMutableMap().apply {
            this[KEY_QUICK_AFFORDANCE_SNAPSHOT_RESTORER] =
                getKeyguardQuickAffordanceSnapshotRestorer(context)
            this[KEY_WALLPAPER_SNAPSHOT_RESTORER] = getWallpaperSnapshotRestorer(context)
        }
    }

@@ -197,7 +198,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject
            }
    }

    protected fun getKeyguardQuickAffordanceSnapshotRestorer(
    private fun getKeyguardQuickAffordanceSnapshotRestorer(
        context: Context
    ): KeyguardQuickAffordanceSnapshotRestorer {
        return keyguardQuickAffordanceSnapshotRestorer
@@ -286,12 +287,13 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject
        @JvmStatic
        private val KEY_QUICK_AFFORDANCE_SNAPSHOT_RESTORER =
            WallpaperPicker2Injector.MIN_SNAPSHOT_RESTORER_KEY
        @JvmStatic
        private val KEY_WALLPAPER_SNAPSHOT_RESTORER = KEY_QUICK_AFFORDANCE_SNAPSHOT_RESTORER + 1

        /**
         * When this injector is overridden, this is the minimal value that should be used by
         * restorers returns in [getSnapshotRestorers].
         */
        @JvmStatic
        protected val MIN_SNAPSHOT_RESTORER_KEY = KEY_QUICK_AFFORDANCE_SNAPSHOT_RESTORER + 1
        @JvmStatic protected val MIN_SNAPSHOT_RESTORER_KEY = KEY_WALLPAPER_SNAPSHOT_RESTORER + 1
    }
}