Chihhang Chuang | adeb353 | 2021-06-10 10:46:50 +0800 | [diff] [blame] | 1 | package com.android.wallpaper.module; |
| 2 | |
Chihhang Chuang | adeb353 | 2021-06-10 10:46:50 +0800 | [diff] [blame] | 3 | import android.os.Bundle; |
| 4 | |
| 5 | import androidx.annotation.Nullable; |
Alejandro Nijamkin | d9b4084 | 2022-11-30 14:46:46 -0800 | [diff] [blame] | 6 | import androidx.fragment.app.FragmentActivity; |
Chihhang Chuang | adeb353 | 2021-06-10 10:46:50 +0800 | [diff] [blame] | 7 | import androidx.lifecycle.LifecycleOwner; |
| 8 | |
Chihhang Chuang | 502bfa8 | 2021-06-15 13:57:59 +0800 | [diff] [blame] | 9 | import com.android.wallpaper.model.CustomizationSectionController; |
| 10 | import com.android.wallpaper.model.CustomizationSectionController.CustomizationSectionNavigationController; |
Chihhang Chuang | adeb353 | 2021-06-10 10:46:50 +0800 | [diff] [blame] | 11 | import com.android.wallpaper.model.PermissionRequester; |
| 12 | import com.android.wallpaper.model.WallpaperColorsViewModel; |
| 13 | import com.android.wallpaper.model.WallpaperPreviewNavigator; |
| 14 | import com.android.wallpaper.model.WallpaperSectionController; |
Catherine Liang | 49102b5 | 2023-02-22 20:45:41 +0000 | [diff] [blame] | 15 | import com.android.wallpaper.picker.customization.domain.interactor.WallpaperInteractor; |
Alejandro Nijamkin | da89b3f | 2022-12-22 15:22:07 -0800 | [diff] [blame] | 16 | import com.android.wallpaper.picker.customization.ui.section.ScreenPreviewSectionController; |
Alejandro Nijamkin | 3deaefd | 2022-12-29 19:04:32 -0800 | [diff] [blame] | 17 | import com.android.wallpaper.picker.customization.ui.section.WallpaperQuickSwitchSectionController; |
Alejandro Nijamkin | 0b064fa | 2023-01-09 15:12:29 -0800 | [diff] [blame] | 18 | import com.android.wallpaper.picker.customization.ui.viewmodel.WallpaperQuickSwitchViewModel; |
Austin Wang | 1563f98 | 2022-12-29 16:17:03 +0800 | [diff] [blame] | 19 | import com.android.wallpaper.util.DisplayUtils; |
Chihhang Chuang | adeb353 | 2021-06-10 10:46:50 +0800 | [diff] [blame] | 20 | |
| 21 | import java.util.ArrayList; |
| 22 | import java.util.List; |
| 23 | |
Chihhang Chuang | 502bfa8 | 2021-06-15 13:57:59 +0800 | [diff] [blame] | 24 | /** {@link CustomizationSections} for the wallpaper picker. */ |
| 25 | public final class WallpaperPickerSections implements CustomizationSections { |
Chihhang Chuang | adeb353 | 2021-06-10 10:46:50 +0800 | [diff] [blame] | 26 | |
| 27 | @Override |
Catherine Liang | 15a626f | 2023-01-09 18:58:26 +0000 | [diff] [blame] | 28 | public List<CustomizationSectionController<?>> getRevampedUISectionControllersForScreen( |
Alejandro Nijamkin | b100bf9 | 2022-12-19 10:52:46 -0800 | [diff] [blame] | 29 | Screen screen, |
| 30 | FragmentActivity activity, |
| 31 | LifecycleOwner lifecycleOwner, |
| 32 | WallpaperColorsViewModel wallpaperColorsViewModel, |
Alejandro Nijamkin | b100bf9 | 2022-12-19 10:52:46 -0800 | [diff] [blame] | 33 | PermissionRequester permissionRequester, |
| 34 | WallpaperPreviewNavigator wallpaperPreviewNavigator, |
| 35 | CustomizationSectionNavigationController sectionNavigationController, |
Alejandro Nijamkin | da89b3f | 2022-12-22 15:22:07 -0800 | [diff] [blame] | 36 | @Nullable Bundle savedInstanceState, |
Austin Wang | 1563f98 | 2022-12-29 16:17:03 +0800 | [diff] [blame] | 37 | CurrentWallpaperInfoFactory wallpaperInfoFactory, |
Alejandro Nijamkin | 3deaefd | 2022-12-29 19:04:32 -0800 | [diff] [blame] | 38 | DisplayUtils displayUtils, |
Catherine Liang | 49102b5 | 2023-02-22 20:45:41 +0000 | [diff] [blame] | 39 | WallpaperQuickSwitchViewModel wallpaperQuickSwitchViewModel, |
| 40 | WallpaperInteractor wallpaperInteractor) { |
Alejandro Nijamkin | b100bf9 | 2022-12-19 10:52:46 -0800 | [diff] [blame] | 41 | List<CustomizationSectionController<?>> sectionControllers = new ArrayList<>(); |
| 42 | |
| 43 | sectionControllers.add( |
Alejandro Nijamkin | da89b3f | 2022-12-22 15:22:07 -0800 | [diff] [blame] | 44 | new ScreenPreviewSectionController( |
| 45 | activity, |
| 46 | lifecycleOwner, |
| 47 | screen, |
| 48 | wallpaperInfoFactory, |
Austin Wang | 1563f98 | 2022-12-29 16:17:03 +0800 | [diff] [blame] | 49 | wallpaperColorsViewModel, |
Alejandro Nijamkin | 3c1e4d0 | 2023-02-10 11:19:04 -0800 | [diff] [blame] | 50 | displayUtils, |
Catherine Liang | 49102b5 | 2023-02-22 20:45:41 +0000 | [diff] [blame] | 51 | sectionNavigationController, |
| 52 | wallpaperInteractor)); |
Alejandro Nijamkin | 3deaefd | 2022-12-29 19:04:32 -0800 | [diff] [blame] | 53 | sectionControllers.add( |
| 54 | new WallpaperQuickSwitchSectionController( |
Alejandro Nijamkin | 46c344c | 2023-01-10 16:25:23 -0800 | [diff] [blame] | 55 | screen, |
Alejandro Nijamkin | 0b064fa | 2023-01-09 15:12:29 -0800 | [diff] [blame] | 56 | wallpaperQuickSwitchViewModel, |
Alejandro Nijamkin | 1a530a4 | 2023-01-10 13:24:02 -0800 | [diff] [blame] | 57 | lifecycleOwner, |
| 58 | sectionNavigationController)); |
Alejandro Nijamkin | b100bf9 | 2022-12-19 10:52:46 -0800 | [diff] [blame] | 59 | |
| 60 | return sectionControllers; |
| 61 | } |
| 62 | |
| 63 | @Override |
Alejandro Nijamkin | d9b4084 | 2022-11-30 14:46:46 -0800 | [diff] [blame] | 64 | public List<CustomizationSectionController<?>> getAllSectionControllers( |
| 65 | FragmentActivity activity, |
| 66 | LifecycleOwner lifecycleOwner, |
| 67 | WallpaperColorsViewModel wallpaperColorsViewModel, |
Alejandro Nijamkin | d9b4084 | 2022-11-30 14:46:46 -0800 | [diff] [blame] | 68 | PermissionRequester permissionRequester, |
Chihhang Chuang | adeb353 | 2021-06-10 10:46:50 +0800 | [diff] [blame] | 69 | WallpaperPreviewNavigator wallpaperPreviewNavigator, |
Chihhang Chuang | 502bfa8 | 2021-06-15 13:57:59 +0800 | [diff] [blame] | 70 | CustomizationSectionNavigationController sectionNavigationController, |
Austin Wang | 1563f98 | 2022-12-29 16:17:03 +0800 | [diff] [blame] | 71 | @Nullable Bundle savedInstanceState, |
| 72 | DisplayUtils displayUtils) { |
Chihhang Chuang | 502bfa8 | 2021-06-15 13:57:59 +0800 | [diff] [blame] | 73 | List<CustomizationSectionController<?>> sectionControllers = new ArrayList<>(); |
Chihhang Chuang | adeb353 | 2021-06-10 10:46:50 +0800 | [diff] [blame] | 74 | |
Alejandro Nijamkin | 58ef369 | 2023-02-06 13:35:48 -0800 | [diff] [blame] | 75 | sectionControllers.add( |
| 76 | new WallpaperSectionController( |
| 77 | activity, |
| 78 | lifecycleOwner, |
| 79 | permissionRequester, |
| 80 | wallpaperColorsViewModel, |
| 81 | null, |
| 82 | sectionNavigationController, |
| 83 | wallpaperPreviewNavigator, |
| 84 | savedInstanceState, |
| 85 | displayUtils)); |
Chihhang Chuang | adeb353 | 2021-06-10 10:46:50 +0800 | [diff] [blame] | 86 | |
| 87 | return sectionControllers; |
| 88 | } |
| 89 | } |