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();
// 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;
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) {
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