Customizable lock screen affordance entry-point.
Adds an entry-point from the wallpaper picker to a fragment that's
dedicated to show the quick affordance picker. The fragment is currently
just blank.
Bug: 254858701
Test: https://screenshot.googleplex.com/txXtXu86w59HcMB - it shows the
names and icons of the selected affordances correctly and clicking it navigates to
the empty page/fragment
Change-Id: Ibe13ced81e45eb3339c013d9c541452f8dc36662
diff --git a/src/com/android/wallpaper/module/CustomizationSections.java b/src/com/android/wallpaper/module/CustomizationSections.java
index c611d50..551d82d 100644
--- a/src/com/android/wallpaper/module/CustomizationSections.java
+++ b/src/com/android/wallpaper/module/CustomizationSections.java
@@ -1,9 +1,9 @@
package com.android.wallpaper.module;
-import android.app.Activity;
import android.os.Bundle;
import androidx.annotation.Nullable;
+import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.LifecycleOwner;
import com.android.wallpaper.model.CustomizationSectionController;
@@ -26,7 +26,7 @@
* <p>Don't keep the section controllers as singleton since they contain views.
*/
List<CustomizationSectionController<?>> getAllSectionControllers(
- Activity activity,
+ FragmentActivity activity,
LifecycleOwner lifecycleOwner,
WallpaperColorsViewModel wallpaperColorsViewModel,
WorkspaceViewModel workspaceViewModel,
diff --git a/src/com/android/wallpaper/module/Injector.java b/src/com/android/wallpaper/module/Injector.java
index 2f14060..6fbe6cd 100755
--- a/src/com/android/wallpaper/module/Injector.java
+++ b/src/com/android/wallpaper/module/Injector.java
@@ -15,6 +15,7 @@
*/
package com.android.wallpaper.module;
+import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@@ -61,7 +62,7 @@
/**
* Get {@link CustomizationSections}
*/
- CustomizationSections getCustomizationSections();
+ CustomizationSections getCustomizationSections(Activity activity);
/**
* Get {@link Intent} for a deep link
diff --git a/src/com/android/wallpaper/module/WallpaperPicker2Injector.java b/src/com/android/wallpaper/module/WallpaperPicker2Injector.java
index b565a5d..f17d392 100755
--- a/src/com/android/wallpaper/module/WallpaperPicker2Injector.java
+++ b/src/com/android/wallpaper/module/WallpaperPicker2Injector.java
@@ -21,6 +21,7 @@
import static com.android.wallpaper.picker.PreviewFragment.ARG_VIEW_AS_HOME;
import static com.android.wallpaper.picker.PreviewFragment.ARG_WALLPAPER;
+import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@@ -106,7 +107,7 @@
}
@Override
- public CustomizationSections getCustomizationSections() {
+ public CustomizationSections getCustomizationSections(Activity activity) {
if (mCustomizationSections == null) {
mCustomizationSections = new WallpaperPickerSections();
}
diff --git a/src/com/android/wallpaper/module/WallpaperPickerSections.java b/src/com/android/wallpaper/module/WallpaperPickerSections.java
index b5e8d17..39daa3d 100644
--- a/src/com/android/wallpaper/module/WallpaperPickerSections.java
+++ b/src/com/android/wallpaper/module/WallpaperPickerSections.java
@@ -1,9 +1,9 @@
package com.android.wallpaper.module;
-import android.app.Activity;
import android.os.Bundle;
import androidx.annotation.Nullable;
+import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.LifecycleOwner;
import com.android.wallpaper.model.CustomizationSectionController;
@@ -21,9 +21,12 @@
public final class WallpaperPickerSections implements CustomizationSections {
@Override
- public List<CustomizationSectionController<?>> getAllSectionControllers(Activity activity,
- LifecycleOwner lifecycleOwner, WallpaperColorsViewModel wallpaperColorsViewModel,
- WorkspaceViewModel workspaceViewModel, PermissionRequester permissionRequester,
+ public List<CustomizationSectionController<?>> getAllSectionControllers(
+ FragmentActivity activity,
+ LifecycleOwner lifecycleOwner,
+ WallpaperColorsViewModel wallpaperColorsViewModel,
+ WorkspaceViewModel workspaceViewModel,
+ PermissionRequester permissionRequester,
WallpaperPreviewNavigator wallpaperPreviewNavigator,
CustomizationSectionNavigationController sectionNavigationController,
@Nullable Bundle savedInstanceState) {
diff --git a/src/com/android/wallpaper/picker/CustomizationPickerFragment.java b/src/com/android/wallpaper/picker/CustomizationPickerFragment.java
index dd0719f..0233518 100644
--- a/src/com/android/wallpaper/picker/CustomizationPickerFragment.java
+++ b/src/com/android/wallpaper/picker/CustomizationPickerFragment.java
@@ -37,6 +37,7 @@
import com.android.wallpaper.model.WallpaperPreviewNavigator;
import com.android.wallpaper.model.WorkspaceViewModel;
import com.android.wallpaper.module.CustomizationSections;
+import com.android.wallpaper.module.Injector;
import com.android.wallpaper.module.InjectorProvider;
import com.android.wallpaper.util.ActivityUtils;
@@ -188,16 +189,24 @@
mSectionControllers.forEach(CustomizationSectionController::release);
mSectionControllers.clear();
+ final Injector injector = InjectorProvider.getInjector();
+
WallpaperColorsViewModel wcViewModel = new ViewModelProvider(getActivity())
.get(WallpaperColorsViewModel.class);
WorkspaceViewModel workspaceViewModel = new ViewModelProvider(getActivity())
.get(WorkspaceViewModel.class);
- CustomizationSections sections = InjectorProvider.getInjector().getCustomizationSections();
+ CustomizationSections sections = injector.getCustomizationSections(getActivity());
List<CustomizationSectionController<?>> allSectionControllers =
- sections.getAllSectionControllers(getActivity(), getViewLifecycleOwner(),
- wcViewModel, workspaceViewModel, getPermissionRequester(),
- getWallpaperPreviewNavigator(), this, savedInstanceState);
+ sections.getAllSectionControllers(
+ getActivity(),
+ getViewLifecycleOwner(),
+ wcViewModel,
+ workspaceViewModel,
+ getPermissionRequester(),
+ getWallpaperPreviewNavigator(),
+ this,
+ savedInstanceState);
mSectionControllers.addAll(getAvailableSections(allSectionControllers));
}