From cd7c0aad5fd7245981fe615103ea62c85239a2bb Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 19 Oct 2017 12:36:27 -0700 Subject: Changing LauncherState to a class to allow adding custom functionality Bug: 67678570 Change-Id: I777e335e9fdf7014b041addff6b8e54fb94167bb --- .../WorkspaceStateTransitionAnimation.java | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/com/android/launcher3/WorkspaceStateTransitionAnimation.java') diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java index 8e215b033..af56fd77c 100644 --- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java +++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java @@ -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(); -- cgit v1.2.3