Changing LauncherState to a class to allow adding custom functionality

Bug: 67678570
Change-Id: I777e335e9fdf7014b041addff6b8e54fb94167bb
This commit is contained in:
Sunny Goyal
2017-10-19 12:36:27 -07:00
parent f9403d92fa
commit cd7c0aad5f
3 changed files with 48 additions and 35 deletions

View File

@@ -18,6 +18,8 @@ package com.android.launcher3;
import static com.android.launcher3.LauncherAnimUtils.DRAWABLE_ALPHA;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.SPRING_LOADED;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -187,18 +189,15 @@ public class WorkspaceStateTransitionAnimation {
int finalBackgroundAlpha = state.hasScrim ? 255 : 0;
final float finalWorkspaceTranslationY;
switch (state) {
case OVERVIEW:
mNewScale = mOverviewModeShrinkFactor;
finalWorkspaceTranslationY = mWorkspace.getOverviewModeTranslationY();
break;
case SPRING_LOADED:
mNewScale = mSpringLoadedShrinkFactor;
finalWorkspaceTranslationY = mWorkspace.getSpringLoadedTranslationY();
break;
default:
mNewScale = 1f;
finalWorkspaceTranslationY = 0;
if (state == OVERVIEW) {
mNewScale = mOverviewModeShrinkFactor;
finalWorkspaceTranslationY = mWorkspace.getOverviewModeTranslationY();
} else if (state == SPRING_LOADED) {
mNewScale = mSpringLoadedShrinkFactor;
finalWorkspaceTranslationY = mWorkspace.getSpringLoadedTranslationY();
} else {
mNewScale = 1f;
finalWorkspaceTranslationY = 0;
}
int toPage = mWorkspace.getPageNearestToCenterOfScreen();