Fix small issue with wallpaper jump

Change-Id: I1f9ad36b7c96528f70b82804f2505bc97c453a32
This commit is contained in:
Adam Cohen
2011-09-01 13:10:40 -07:00
parent 3c81a3835b
commit 5037a0b02a
+5 -5
View File
@@ -819,23 +819,23 @@ public class Workspace extends SmoothPagedView
@Override
protected void updateCurrentPageScroll() {
super.updateCurrentPageScroll();
computeWallpaperScrollRatio();
computeWallpaperScrollRatio(mCurrentPage);
}
@Override
protected void snapToPage(int whichPage) {
super.snapToPage(whichPage);
computeWallpaperScrollRatio();
computeWallpaperScrollRatio(whichPage);
}
private void computeWallpaperScrollRatio() {
private void computeWallpaperScrollRatio(int page) {
// Here, we determine what the desired scroll would be with and without a layout scale,
// and compute a ratio between the two. This allows us to adjust the wallpaper offset
// as though there is no layout scale.
float layoutScale = mLayoutScale;
int scaled = getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage);
int scaled = getChildOffset(page) - getRelativeChildOffset(page);
mLayoutScale = 1.0f;
float unscaled = getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage);
float unscaled = getChildOffset(page) - getRelativeChildOffset(page);
mLayoutScale = layoutScale;
if (scaled > 0) {
mWallpaperScrollRatio = (1.0f * unscaled) / scaled;