google_pixel: ThemePickerGoogle: Implement default customization sections

Change-Id: I8d7390a3710883688028b22e7027f8a4002f40c8
lineage-19.1
Anay Wadhera 3 years ago committed by Nolen Johnson
parent 379bce770a
commit 434b888938
  1. 15
      ThemePickerGoogle/src/com/google/android/customization/module/GoogleCustomizationInjector.kt
  2. 59
      ThemePickerGoogle/src/com/google/android/customization/module/GoogleCustomizationSections.java

@ -1,5 +1,18 @@
package com.google.android.customization.module
import com.android.wallpaper.module.CustomizationSections
import com.android.customization.module.DefaultCustomizationInjector
public class GoogleCustomizationInjector : DefaultCustomizationInjector()
public class GoogleCustomizationInjector : DefaultCustomizationInjector() {
private var customizationSections: CustomizationSections? = null
override fun getCustomizationSections(): CustomizationSections {
if (customizationSections == null) {
customizationSections = GoogleCustomizationSections()
}
return customizationSections!!
}
}

@ -0,0 +1,59 @@
package com.google.android.customization.module;
import android.app.Activity;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.lifecycle.LifecycleOwner;
import com.android.customization.model.grid.GridOptionsManager;
import com.android.customization.model.grid.GridSectionController;
import com.android.customization.model.mode.DarkModeSectionController;
import com.android.customization.model.themedicon.ThemedIconSectionController;
import com.android.customization.model.themedicon.ThemedIconSwitchProvider;
import com.android.wallpaper.model.CustomizationSectionController;
import com.android.wallpaper.model.CustomizationSectionController.CustomizationSectionNavigationController;
import com.android.wallpaper.model.PermissionRequester;
import com.android.wallpaper.model.WallpaperColorsViewModel;
import com.android.wallpaper.model.WallpaperPreviewNavigator;
import com.android.wallpaper.model.WallpaperSectionController;
import com.android.wallpaper.model.WorkspaceViewModel;
import com.android.wallpaper.module.CustomizationSections;
import java.util.ArrayList;
import java.util.List;
/** {@link CustomizationSections} for the customization picker. */
public final class GoogleCustomizationSections implements CustomizationSections {
@Override
public List<CustomizationSectionController<?>> getAllSectionControllers(Activity activity,
LifecycleOwner lifecycleOwner, WallpaperColorsViewModel wallpaperColorsViewModel,
WorkspaceViewModel workspaceViewModel, PermissionRequester permissionRequester,
WallpaperPreviewNavigator wallpaperPreviewNavigator,
CustomizationSectionNavigationController sectionNavigationController,
@Nullable Bundle savedInstanceState) {
List<CustomizationSectionController<?>> sectionControllers = new ArrayList<>();
// Wallpaper section.
sectionControllers.add(new WallpaperSectionController(
activity, lifecycleOwner, permissionRequester, wallpaperColorsViewModel,
workspaceViewModel, sectionNavigationController, wallpaperPreviewNavigator,
savedInstanceState));
// Dark/Light theme section.
sectionControllers.add(new DarkModeSectionController(activity,
lifecycleOwner.getLifecycle()));
// Themed app icon section.
sectionControllers.add(new ThemedIconSectionController(
ThemedIconSwitchProvider.getInstance(activity), workspaceViewModel,
savedInstanceState));
// App grid section.
sectionControllers.add(new GridSectionController(
GridOptionsManager.getInstance(activity), sectionNavigationController));
return sectionControllers;
}
}
Loading…
Cancel
Save