From 624cea3f7b0aa7c9a8fe40cb804d248a0ec86265 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 13 Sep 2013 15:54:41 -0700 Subject: [PATCH] Tweaking animation while scrolling to custom content page. (Bug 10394396) Change-Id: I792439eb6b052ba747ab115ffd345638382ac58d --- src/com/android/launcher3/Workspace.java | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 3f63d743a8..682dde9906 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -1269,6 +1269,7 @@ public class Workspace extends SmoothPagedView if (hasCustomContent() && !isSmall() && !isSwitchingState()) { int index = mScreenOrder.indexOf(CUSTOM_CONTENT_SCREEN_ID); int scrollDelta = getScrollForPage(index + 1) - getScrollX(); + float translationX = Math.max(scrollDelta, 0); float progress = (1.0f * scrollDelta) / (getScrollForPage(index + 1) - getScrollForPage(index)); progress = Math.max(0, progress); @@ -1277,28 +1278,13 @@ public class Workspace extends SmoothPagedView mLastCustomContentScrollProgress = progress; setBackgroundAlpha(progress * 0.8f); - float height = getViewportHeight(); - if (getPageIndicator() != null) { - height -= getPageIndicator().getTop(); - } else if (mLauncher.getHotseat() != null) { - height -= mLauncher.getHotseat().getTop(); - } - float transY = progress * height; if (mLauncher.getHotseat() != null) { - mLauncher.getHotseat().setTranslationY(transY); - mLauncher.getHotseat().setAlpha(1 - progress); + mLauncher.getHotseat().setTranslationX(translationX); } if (getPageIndicator() != null) { - final float alpha = 1 - progress; - final View pi = getPageIndicator(); - getPageIndicator().setAlpha(alpha); - if (alpha < ALPHA_CUTOFF_THRESHOLD && pi.getVisibility() != INVISIBLE) { - pi.setVisibility(INVISIBLE); - } else if (alpha > ALPHA_CUTOFF_THRESHOLD && pi.getVisibility() != VISIBLE) { - pi.setVisibility(VISIBLE); - } + getPageIndicator().setTranslationX(translationX); } if (mCustomContentCallbacks != null) {