summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Wang <wangaustin@google.com>2023-01-06 02:22:48 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2023-01-06 02:22:48 +0000
commit2f0d97629d6a3ca0110f3925f4090fe0831a1eba (patch)
treee436117b60cefee8372789fadb6f48dd85658532
parent4bece02e7c73a66535f559992dd9cd0165b8ec1b (diff)
parente0abb501f70a1d43bb7ba86881baa40e956ed990 (diff)
downloadThemePicker-2f0d97629d6a3ca0110f3925f4090fe0831a1eba.tar.gz
Merge "Offset preview to start if on wallpaper display" into tm-qpr-dev
-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,