ThemePickerLeaf: Expose quick affordances section on default UI
Co-Authored-By: Tim Zimmermann <tim@linux4.de>
Change-Id: I9c87b6c84acd00329cb94d3f79db25c9c3412aef
diff --git a/src/org/leafos/customization/module/LeafCustomizationSections.java b/src/org/leafos/customization/module/LeafCustomizationSections.java
index 6d752b0..073d0af 100644
--- a/src/org/leafos/customization/module/LeafCustomizationSections.java
+++ b/src/org/leafos/customization/module/LeafCustomizationSections.java
@@ -20,6 +20,7 @@
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.LifecycleOwner;
+import androidx.lifecycle.ViewModelProvider;
import org.leafos.customization.model.font.FontManager;
import org.leafos.customization.model.font.FontSectionController;
@@ -29,6 +30,9 @@
import org.leafos.customization.model.iconshape.IconShapeSectionController;
import com.android.customization.model.theme.OverlayManagerCompat;
+import com.android.customization.picker.quickaffordance.domain.interactor.KeyguardQuickAffordancePickerInteractor;
+import com.android.customization.picker.quickaffordance.ui.section.KeyguardQuickAffordanceSectionController;
+import com.android.customization.picker.quickaffordance.ui.viewmodel.KeyguardQuickAffordancePickerViewModel;
import com.android.wallpaper.model.CustomizationSectionController;
import com.android.wallpaper.model.CustomizationSectionController.CustomizationSectionNavigationController;
import com.android.wallpaper.model.PermissionRequester;
@@ -44,9 +48,18 @@
public class LeafCustomizationSections implements CustomizationSections {
private CustomizationSections mDefaultCustomizationSections;
+ private final KeyguardQuickAffordancePickerInteractor mKeyguardQuickAffordancePickerInteractor;
+ private final KeyguardQuickAffordancePickerViewModel.Factory
+ mKeyguardQuickAffordancePickerViewModelFactory;
- public LeafCustomizationSections(CustomizationSections defaultCustomizationSections) {
+ public LeafCustomizationSections(CustomizationSections defaultCustomizationSections,
+ KeyguardQuickAffordancePickerInteractor keyguardQuickAffordancePickerInteractor,
+ KeyguardQuickAffordancePickerViewModel.Factory
+ keyguardQuickAffordancePickerViewModelFactory) {
mDefaultCustomizationSections = defaultCustomizationSections;
+ mKeyguardQuickAffordancePickerInteractor = keyguardQuickAffordancePickerInteractor;
+ mKeyguardQuickAffordancePickerViewModelFactory =
+ keyguardQuickAffordancePickerViewModelFactory;
}
@Override
@@ -113,6 +126,17 @@
sections.add(new IconShapeSectionController(
IconShapeManager.getInstance(activity, new OverlayManagerCompat(activity)), sectionNavigationController));
+ // Lock screen quick affordances section.
+ sections.add(
+ new KeyguardQuickAffordanceSectionController(
+ sectionNavigationController,
+ mKeyguardQuickAffordancePickerInteractor,
+ new ViewModelProvider(
+ activity,
+ mKeyguardQuickAffordancePickerViewModelFactory)
+ .get(KeyguardQuickAffordancePickerViewModel.class),
+ lifecycleOwner));
+
return sections;
}
}
diff --git a/src/org/leafos/customization/module/LeafThemePickerInjector.java b/src/org/leafos/customization/module/LeafThemePickerInjector.java
index d7f71dc..d526b9e 100644
--- a/src/org/leafos/customization/module/LeafThemePickerInjector.java
+++ b/src/org/leafos/customization/module/LeafThemePickerInjector.java
@@ -27,7 +27,9 @@
public CustomizationSections getCustomizationSections(ComponentActivity activity) {
if (mCustomizationSections == null) {
mCustomizationSections = new LeafCustomizationSections(
- super.getCustomizationSections(activity));
+ super.getCustomizationSections(activity),
+ getKeyguardQuickAffordancePickerInteractor(activity),
+ getKeyguardQuickAffordancePickerViewModelFactory(activity));
}
return mCustomizationSections;
}