Merge "Wallpaper preview parallax matches the actual wallpaper's." into ub-launcher3-burnaby-polish

This commit is contained in:
Tony Wickham
2015-09-14 18:39:56 +00:00
committed by Android (Google) Code Review
8 changed files with 141 additions and 56 deletions
+6 -2
View File
@@ -1410,7 +1410,7 @@ public class Workspace extends PagedView
return false;
}
private float wallpaperOffsetForCurrentScroll() {
public float wallpaperOffsetForScroll(int scroll) {
// TODO: do different behavior if it's a live wallpaper?
// Don't use up all the wallpaper parallax until you have at least
// MIN_PARALLAX_PAGE_SPAN pages
@@ -1449,7 +1449,7 @@ public class Workspace extends PagedView
// Sometimes the left parameter of the pages is animated during a layout transition;
// this parameter offsets it to keep the wallpaper from animating as well
int adjustedScroll =
getScrollX() - firstPageScrollX - getLayoutTransitionOffsetForPage(0);
scroll - firstPageScrollX - getLayoutTransitionOffsetForPage(0);
float offset = Math.min(1, adjustedScroll / (float) scrollRange);
offset = Math.max(0, offset);
@@ -1463,6 +1463,10 @@ public class Workspace extends PagedView
}
}
private float wallpaperOffsetForCurrentScroll() {
return wallpaperOffsetForScroll(getScrollX());
}
private int numEmptyScreensToIgnore() {
int numScrollingPages = getChildCount() - numCustomPages();
if (numScrollingPages >= MIN_PARALLAX_PAGE_SPAN && hasExtraEmptyScreen()) {