diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-10-24 10:32:40 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-10-24 10:39:24 -0700 |
commit | 4d519f25687a95d450666cf8452b9ba57bd36eb9 (patch) | |
tree | 523f717b2dc1b3e610c97c789305ee8bdef4c60b /src/com/android/launcher3/WorkspaceStateTransitionAnimation.java | |
parent | be93f264d74eed6d43d6c75694624d53d6877357 (diff) | |
download | android_packages_apps_Trebuchet-4d519f25687a95d450666cf8452b9ba57bd36eb9.tar.gz android_packages_apps_Trebuchet-4d519f25687a95d450666cf8452b9ba57bd36eb9.tar.bz2 android_packages_apps_Trebuchet-4d519f25687a95d450666cf8452b9ba57bd36eb9.zip |
Enable overview state restore
> Reapplying CellLayout state when new pages are added (page bind comes after restore)
> Removing support for different scroll range for freescroll (the calculations were not
consistant with maxScroll)
Bug: 67678570
Change-Id: Ic1911de1b707f2f6940e7040f07ca7e733e2ef2a
Diffstat (limited to 'src/com/android/launcher3/WorkspaceStateTransitionAnimation.java')
-rw-r--r-- | src/com/android/launcher3/WorkspaceStateTransitionAnimation.java | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java index d66255bda..ff653d7ea 100644 --- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java +++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java @@ -178,9 +178,6 @@ public class WorkspaceStateTransitionAnimation { * Starts a transition animation for the workspace. */ private void setWorkspaceProperty(LauncherState state, PropertySetter propertySetter) { - // Update the workspace state - int finalBackgroundAlpha = state.hasScrim ? 255 : 0; - float[] scaleAndTranslationY = state.getWorkspaceScaleAndTranslation(mLauncher); mNewScale = scaleAndTranslationY[0]; final float finalWorkspaceTranslationY = scaleAndTranslationY[1]; @@ -188,16 +185,8 @@ public class WorkspaceStateTransitionAnimation { int toPage = mWorkspace.getPageNearestToCenterOfScreen(); final int childCount = mWorkspace.getChildCount(); for (int i = 0; i < childCount; i++) { - final CellLayout cl = (CellLayout) mWorkspace.getChildAt(i); - propertySetter.setInt(cl.getScrimBackground(), - DRAWABLE_ALPHA, finalBackgroundAlpha, mZoomInInterpolator); - - // Only animate the page alpha when we actually fade pages - if (mWorkspaceFadeInAdjacentScreens) { - float finalAlpha = state == LauncherState.NORMAL && i != toPage ? 0 : 1f; - propertySetter.setFloat(cl.getShortcutsAndWidgets(), View.ALPHA, - finalAlpha, mZoomInInterpolator); - } + applyChildState(state, (CellLayout) mWorkspace.getChildAt(i), i, toPage, + propertySetter); } float finalHotseatAlpha = state.hideHotseat ? 0f : 1f; @@ -217,6 +206,24 @@ public class WorkspaceStateTransitionAnimation { state.hasScrim ? mWorkspaceScrimAlpha : 0, new DecelerateInterpolator(1.5f)); } + public void applyChildState(LauncherState state, CellLayout cl, int childIndex) { + applyChildState(state, cl, childIndex, mWorkspace.getPageNearestToCenterOfScreen(), + NO_ANIM_PROPERTY_SETTER); + } + + private void applyChildState(LauncherState state, CellLayout cl, int childIndex, + int centerPage, PropertySetter propertySetter) { + propertySetter.setInt(cl.getScrimBackground(), + DRAWABLE_ALPHA, state.hasScrim ? 255 : 0, mZoomInInterpolator); + + // Only animate the page alpha when we actually fade pages + if (mWorkspaceFadeInAdjacentScreens) { + float finalAlpha = state == LauncherState.NORMAL && childIndex != centerPage ? 0 : 1f; + propertySetter.setFloat(cl.getShortcutsAndWidgets(), View.ALPHA, + finalAlpha, mZoomInInterpolator); + } + } + private static class PropertySetter { public void setViewAlpha(Animator anim, View view, float alpha) { |