summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2011-03-07 16:53:12 -0800
committerMichael Jurka <mikejurka@google.com>2011-03-09 14:07:36 -0800
commitf70c78142457b0e9c691f2a20ed87407c7433f5b (patch)
treefd88fcda9c2430ce059ae67814193fa4b4466e6e /src/com/android
parentbbaa75c8c432c46c00ee2eb836e438b3774d6709 (diff)
downloadandroid_packages_apps_Trebuchet-f70c78142457b0e9c691f2a20ed87407c7433f5b.tar.gz
android_packages_apps_Trebuchet-f70c78142457b0e9c691f2a20ed87407c7433f5b.tar.bz2
android_packages_apps_Trebuchet-f70c78142457b0e9c691f2a20ed87407c7433f5b.zip
Fix reported wallpaper offset in portrait mode for live wallpapers
Bug # 3442622
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher2/Workspace.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 5a230eb90..5f70bfbeb 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -733,11 +733,15 @@ public class Workspace extends SmoothPagedView
private float wallpaperOffsetForCurrentScroll() {
Display display = mLauncher.getWindowManager().getDefaultDisplay();
+ final boolean isStaticWallpaper = (mWallpaperManager.getWallpaperInfo() == null);
// The wallpaper travel width is how far, from left to right, the wallpaper will move
// at this orientation (for example, in portrait mode we don't move all the way to the
// edges of the wallpaper, or otherwise the parallax effect would be too strong)
int wallpaperTravelWidth = (int) (display.getWidth() *
wallpaperTravelToScreenWidthRatio(display.getWidth(), display.getHeight()));
+ if (!isStaticWallpaper) {
+ wallpaperTravelWidth = mWallpaperWidth;
+ }
// Set wallpaper offset steps (1 / (number of screens - 1))
// We have 3 vertical offset states (centered, and then top/bottom aligned
@@ -751,7 +755,6 @@ public class Workspace extends SmoothPagedView
// you overscroll as far as you can in landscape mode. Only do this for static wallpapers
// because live wallpapers (and probably 3rd party wallpaper providers) rely on the offset
// being even intervals from 0 to 1 (eg [0, 0.25, 0.5, 0.75, 1])
- final boolean isStaticWallpaper = (mWallpaperManager.getWallpaperInfo() == null);
if (isStaticWallpaper) {
int overscrollOffset = (int) (maxOverScroll() * display.getWidth());
scrollProgressOffset += overscrollOffset / (float) getScrollRange();
@@ -761,7 +764,7 @@ public class Workspace extends SmoothPagedView
float scrollProgress =
mScrollX / (float) scrollRange + scrollProgressOffset;
float offsetInDips = wallpaperTravelWidth * scrollProgress +
- (mWallpaperWidth - wallpaperTravelWidth) / 2;
+ (mWallpaperWidth - wallpaperTravelWidth) / 2; // center it
float offset = offsetInDips / (float) mWallpaperWidth;
return offset;
}