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
This commit is contained in:
Sunny Goyal
2017-10-24 10:32:40 -07:00
parent be93f264d7
commit 4d519f2568
5 changed files with 36 additions and 77 deletions

View File

@@ -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) {