Wallpaper preview parallax matches the actual wallpaper's.
Cherry picking the following changes from ub-launcher3-master:
Change-Id: I41c5bbbfdabfeb4e20d77e9b5804842a03211edf
Change-Id: I69afa3f8cc59c77e9c4c25e29e8db8c4beb87462
Change-Id: I82b7ba506d51ee4b3812af5fbdf95d3303b37aef
Change-Id: Id7c2b5483c5535d59be2f8a459ce7788e3c8318a
Bug: 23568800
Change-Id: I343169b9fdc5ceaab3d4b39044627d78b7267868
(cherry picked from commit 3e776a87dc5178ab7d2c31a8db06fe5657db4e4a)
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 1f843cb..0a085f6 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -748,6 +748,9 @@
return;
} else if (requestCode == REQUEST_PICK_WALLPAPER) {
if (resultCode == RESULT_OK && mWorkspace.isInOverviewMode()) {
+ // User could have free-scrolled between pages before picking a wallpaper; make sure
+ // we move to the closest one now to avoid visual jump.
+ mWorkspace.setCurrentPage(mWorkspace.getPageNearestToCenterOfScreen());
showWorkspace(false);
}
return;
@@ -2744,7 +2747,10 @@
*/
protected void onClickWallpaperPicker(View v) {
if (LOGD) Log.d(TAG, "onClickWallpaperPicker");
- startActivityForResult(new Intent(Intent.ACTION_SET_WALLPAPER).setPackage(getPackageName()),
+ int pageScroll = mWorkspace.getScrollForPage(mWorkspace.getPageNearestToCenterOfScreen());
+ float offset = mWorkspace.mWallpaperOffset.wallpaperOffsetForScroll(pageScroll);
+ startActivityForResult(new Intent(Intent.ACTION_SET_WALLPAPER).setPackage(getPackageName())
+ .putExtra(WallpaperPickerActivity.EXTRA_WALLPAPER_OFFSET, offset),
REQUEST_PICK_WALLPAPER);
if (mLauncherCallbacks != null) {