am 2a4f4928: Fix bug: Scroll position reported incorrectly to live wallpapers
* commit '2a4f4928a964fa8eef9ea6542f835ad4a79b9bd5': Fix bug: Scroll position reported incorrectly to live wallpapers
This commit is contained in:
@@ -209,6 +209,10 @@ public class Workspace extends SmoothPagedView
|
||||
private boolean mWorkspaceFadeInAdjacentScreens;
|
||||
|
||||
WallpaperOffsetInterpolator mWallpaperOffset;
|
||||
private boolean mWallpaperIsLiveWallpaper;
|
||||
private int mNumPagesForWallpaperParallax;
|
||||
private float mLastSetWallpaperOffsetSteps = 0;
|
||||
|
||||
private Runnable mDelayedResizeRunnable;
|
||||
private Runnable mDelayedSnapToPageRunnable;
|
||||
private Point mDisplaySize = new Point();
|
||||
@@ -1347,7 +1351,14 @@ public class Workspace extends SmoothPagedView
|
||||
// Don't use up all the wallpaper parallax until you have at least
|
||||
// MIN_PARALLAX_PAGE_SPAN pages
|
||||
int numScrollingPages = getNumScreensExcludingEmptyAndCustom();
|
||||
int parallaxPageSpan = Math.max(MIN_PARALLAX_PAGE_SPAN, numScrollingPages - 1);
|
||||
int parallaxPageSpan;
|
||||
if (mWallpaperIsLiveWallpaper) {
|
||||
parallaxPageSpan = numScrollingPages - 1;
|
||||
} else {
|
||||
parallaxPageSpan = Math.max(MIN_PARALLAX_PAGE_SPAN, numScrollingPages - 1);
|
||||
}
|
||||
mNumPagesForWallpaperParallax = parallaxPageSpan;
|
||||
|
||||
// On RTL devices, push the wallpaper offset to the right if we don't have enough
|
||||
// pages (ie if numScrollingPages < MIN_PARALLAX_PAGE_SPAN)
|
||||
int padding = isLayoutRtl() ? parallaxPageSpan - numScrollingPages + 1 : 0;
|
||||
@@ -1391,7 +1402,11 @@ public class Workspace extends SmoothPagedView
|
||||
|
||||
private void setWallpaperOffsetSteps() {
|
||||
// Set wallpaper offset steps (1 / (number of screens - 1))
|
||||
mWallpaperManager.setWallpaperOffsetSteps(1.0f / (getChildCount() - 1), 1.0f);
|
||||
float xOffset = 1.0f / mNumPagesForWallpaperParallax;
|
||||
if (xOffset != mLastSetWallpaperOffsetSteps) {
|
||||
mWallpaperManager.setWallpaperOffsetSteps(xOffset, 1.0f);
|
||||
mLastSetWallpaperOffsetSteps = xOffset;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFinalX(float x) {
|
||||
@@ -1700,6 +1715,10 @@ public class Workspace extends SmoothPagedView
|
||||
if (LauncherAppState.getInstance().hasWallpaperChangedSinceLastCheck()) {
|
||||
setWallpaperDimension();
|
||||
}
|
||||
mWallpaperIsLiveWallpaper = mWallpaperManager.getWallpaperInfo() != null;
|
||||
// Force the wallpaper offset steps to be set again, because another app might have changed
|
||||
// them
|
||||
mLastSetWallpaperOffsetSteps = 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user