summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Wang <wangaustin@google.com>2022-12-29 16:32:10 +0800
committerAustin Wang <wangaustin@google.com>2023-01-05 01:25:07 +0000
commite0abb501f70a1d43bb7ba86881baa40e956ed990 (patch)
tree4890b45d1dde3706413f30a42082fd37a242f04a
parent3d4f38ff3d451e19db0a07d5d8aa7f2cf45a11c5 (diff)
downloadThemePicker-e0abb501f70a1d43bb7ba86881baa40e956ed990.tar.gz
Offset preview to start if on wallpaper display
For static wallpaper preview, offset the preview to the start of the wallpaper if the current display is the largest display(wallpaper display) on multi-display devices. Other wallpaper remains the same. Test: set multiple wallpapers w/wo fullscreen preview Bug: 259745033 Change-Id: I34b593e706f2d60d7f213f229bc525214bdcca0d
-rw-r--r--src/com/android/customization/module/DefaultCustomizationSections.java12
-rw-r--r--src/com/android/customization/picker/WallpaperPreviewer.java6
-rw-r--r--src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePreviewBinder.kt2
-rw-r--r--src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt2
4 files changed, 16 insertions, 6 deletions
diff --git a/src/com/android/customization/module/DefaultCustomizationSections.java b/src/com/android/customization/module/DefaultCustomizationSections.java
index 1097a716..c47a6e63 100644
--- a/src/com/android/customization/module/DefaultCustomizationSections.java
+++ b/src/com/android/customization/module/DefaultCustomizationSections.java
@@ -26,6 +26,7 @@ import com.android.wallpaper.model.WorkspaceViewModel;
import com.android.wallpaper.module.CurrentWallpaperInfoFactory;
import com.android.wallpaper.module.CustomizationSections;
import com.android.wallpaper.picker.customization.ui.section.ScreenPreviewSectionController;
+import com.android.wallpaper.util.DisplayUtils;
import java.util.ArrayList;
import java.util.List;
@@ -57,7 +58,8 @@ public final class DefaultCustomizationSections implements CustomizationSections
WallpaperPreviewNavigator wallpaperPreviewNavigator,
CustomizationSectionNavigationController sectionNavigationController,
@Nullable Bundle savedInstanceState,
- CurrentWallpaperInfoFactory wallpaperInfoFactory) {
+ CurrentWallpaperInfoFactory wallpaperInfoFactory,
+ DisplayUtils displayUtils) {
List<CustomizationSectionController<?>> sectionControllers = new ArrayList<>();
// Wallpaper section.
@@ -67,7 +69,8 @@ public final class DefaultCustomizationSections implements CustomizationSections
lifecycleOwner,
screen,
wallpaperInfoFactory,
- wallpaperColorsViewModel));
+ wallpaperColorsViewModel,
+ displayUtils));
// Theme color section.
sectionControllers.add(new ColorSectionController(
@@ -115,14 +118,15 @@ public final class DefaultCustomizationSections implements CustomizationSections
PermissionRequester permissionRequester,
WallpaperPreviewNavigator wallpaperPreviewNavigator,
CustomizationSectionNavigationController sectionNavigationController,
- @Nullable Bundle savedInstanceState) {
+ @Nullable Bundle savedInstanceState,
+ DisplayUtils displayUtils) {
List<CustomizationSectionController<?>> sectionControllers = new ArrayList<>();
// Wallpaper section.
sectionControllers.add(new WallpaperSectionController(
activity, lifecycleOwner, permissionRequester, wallpaperColorsViewModel,
workspaceViewModel, sectionNavigationController, wallpaperPreviewNavigator,
- savedInstanceState));
+ savedInstanceState, displayUtils));
// Theme color section.
sectionControllers.add(new ColorSectionController(
diff --git a/src/com/android/customization/picker/WallpaperPreviewer.java b/src/com/android/customization/picker/WallpaperPreviewer.java
index fa7dd815..354eec26 100644
--- a/src/com/android/customization/picker/WallpaperPreviewer.java
+++ b/src/com/android/customization/picker/WallpaperPreviewer.java
@@ -154,14 +154,16 @@ public class WallpaperPreviewer implements LifecycleObserver {
.loadPreviewImage(mActivity,
renderInImageWallpaperSurface ? homeImageWallpaper : mHomePreview,
ResourceUtils.getColorAttr(
- mActivity, android.R.attr.colorSecondary));
+ mActivity, android.R.attr.colorSecondary),
+ /* offsetToStart= */ true);
if (mWallpaper instanceof LiveWallpaperInfo) {
mWallpaper.getThumbAsset(mActivity.getApplicationContext())
.loadPreviewImage(
mActivity,
homeImageWallpaper,
ResourceUtils.getColorAttr(
- mActivity, android.R.attr.colorSecondary));
+ mActivity, android.R.attr.colorSecondary),
+ /* offsetToStart= */ true);
setUpLiveWallpaperPreview(mWallpaper);
} else {
// Ensure live wallpaper connection is disconnected.
diff --git a/src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePreviewBinder.kt b/src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePreviewBinder.kt
index c8fea0f7..9248d66d 100644
--- a/src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePreviewBinder.kt
+++ b/src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePreviewBinder.kt
@@ -39,6 +39,7 @@ object KeyguardQuickAffordancePreviewBinder {
previewView: CardView,
viewModel: KeyguardQuickAffordancePickerViewModel,
lifecycleOwner: LifecycleOwner,
+ offsetToStart: Boolean,
) {
val binding =
ScreenPreviewBinder.bind(
@@ -46,6 +47,7 @@ object KeyguardQuickAffordancePreviewBinder {
previewView = previewView,
viewModel = viewModel.preview,
lifecycleOwner = lifecycleOwner,
+ offsetToStart = offsetToStart,
)
previewView.contentDescription =
diff --git a/src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt b/src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt
index d2245db1..51b98efe 100644
--- a/src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt
+++ b/src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt
@@ -74,6 +74,8 @@ class KeyguardQuickAffordancePickerFragment : AppbarFragment() {
previewView = view.requireViewById(R.id.preview),
viewModel = viewModel,
lifecycleOwner = this,
+ offsetToStart =
+ injector.getDisplayUtils(requireActivity()).isOnWallpaperDisplay(requireActivity())
)
KeyguardQuickAffordancePickerBinder.bind(
view = view,