1 package com.android.wallpaper.module;
2 
3 import android.app.WallpaperManager;
4 import android.os.Bundle;
5 
6 import androidx.annotation.Nullable;
7 import androidx.fragment.app.FragmentActivity;
8 import androidx.lifecycle.LifecycleOwner;
9 
10 import com.android.wallpaper.model.CustomizationSectionController;
11 import com.android.wallpaper.model.CustomizationSectionController.CustomizationSectionNavigationController;
12 import com.android.wallpaper.model.PermissionRequester;
13 import com.android.wallpaper.model.Screen;
14 import com.android.wallpaper.model.WallpaperPreviewNavigator;
15 import com.android.wallpaper.picker.customization.data.repository.WallpaperColorsRepository;
16 import com.android.wallpaper.picker.customization.domain.interactor.WallpaperInteractor;
17 import com.android.wallpaper.picker.customization.ui.section.ScreenPreviewSectionController;
18 import com.android.wallpaper.picker.customization.ui.section.WallpaperQuickSwitchSectionController;
19 import com.android.wallpaper.picker.customization.ui.viewmodel.CustomizationPickerViewModel;
20 import com.android.wallpaper.util.DisplayUtils;
21 
22 import java.util.ArrayList;
23 import java.util.List;
24 
25 /** {@link CustomizationSections} for the wallpaper picker. */
26 public final class WallpaperPickerSections implements CustomizationSections {
27 
28     @Override
getSectionControllersForScreen( Screen screen, FragmentActivity activity, LifecycleOwner lifecycleOwner, WallpaperColorsRepository wallpaperColorsRepository, PermissionRequester permissionRequester, WallpaperPreviewNavigator wallpaperPreviewNavigator, CustomizationSectionNavigationController sectionNavigationController, @Nullable Bundle savedInstanceState, CurrentWallpaperInfoFactory wallpaperInfoFactory, DisplayUtils displayUtils, CustomizationPickerViewModel customizationPickerViewModel, WallpaperInteractor wallpaperInteractor, WallpaperManager wallpaperManager, boolean isTwoPaneAndSmallWidth)29     public List<CustomizationSectionController<?>> getSectionControllersForScreen(
30             Screen screen,
31             FragmentActivity activity,
32             LifecycleOwner lifecycleOwner,
33             WallpaperColorsRepository wallpaperColorsRepository,
34             PermissionRequester permissionRequester,
35             WallpaperPreviewNavigator wallpaperPreviewNavigator,
36             CustomizationSectionNavigationController sectionNavigationController,
37             @Nullable Bundle savedInstanceState,
38             CurrentWallpaperInfoFactory wallpaperInfoFactory,
39             DisplayUtils displayUtils,
40             CustomizationPickerViewModel customizationPickerViewModel,
41             WallpaperInteractor wallpaperInteractor,
42             WallpaperManager wallpaperManager,
43             boolean isTwoPaneAndSmallWidth) {
44         List<CustomizationSectionController<?>> sectionControllers = new ArrayList<>();
45 
46         sectionControllers.add(
47                 new ScreenPreviewSectionController(
48                         activity,
49                         lifecycleOwner,
50                         screen,
51                         wallpaperInfoFactory,
52                         wallpaperColorsRepository,
53                         displayUtils,
54                         wallpaperPreviewNavigator,
55                         wallpaperInteractor,
56                         wallpaperManager,
57                         isTwoPaneAndSmallWidth,
58                         customizationPickerViewModel));
59         sectionControllers.add(
60                 new WallpaperQuickSwitchSectionController(
61                         customizationPickerViewModel.getWallpaperQuickSwitchViewModel(screen),
62                         lifecycleOwner,
63                         sectionNavigationController,
64                         savedInstanceState == null));
65 
66         return sectionControllers;
67     }
68 }
69