summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2017-12-06 10:25:07 -0800
committerSunny Goyal <sunnygoyal@google.com>2017-12-06 14:29:33 -0800
commitbc683e9d067e1346a5a1575ab2315062b8bc41a1 (patch)
tree18a458d2d99f166dd76f269a6f467cdaa1d6653a /src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
parent92731d48d20fceb99a25b70fa72a867699d09f74 (diff)
downloadandroid_packages_apps_Trebuchet-bc683e9d067e1346a5a1575ab2315062b8bc41a1.tar.gz
android_packages_apps_Trebuchet-bc683e9d067e1346a5a1575ab2315062b8bc41a1.tar.bz2
android_packages_apps_Trebuchet-bc683e9d067e1346a5a1575ab2315062b8bc41a1.zip
Separating various UI properties into state variables
> Using workspace scale and translation for all-apps > Without quickstep, workspace has the parallex effect as before > With quickstep, workspace scales down to match the recents card width > Using a single animator for recents views in case of state transtion and controlled transition to prevent going into inconsistant state. Change-Id: I1864de6892052ca771f4d0062e3d60c28840a72d
Diffstat (limited to 'src/com/android/launcher3/WorkspaceStateTransitionAnimation.java')
-rw-r--r--src/com/android/launcher3/WorkspaceStateTransitionAnimation.java28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index 8edec40d2..edf5ada6e 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -26,11 +26,11 @@ import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.content.Context;
-import android.content.res.Resources;
import android.util.Property;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
+import com.android.launcher3.LauncherState.PageAlphaProvider;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.anim.AnimationLayerSet;
import com.android.launcher3.anim.Interpolators;
@@ -97,18 +97,13 @@ public class WorkspaceStateTransitionAnimation {
private final Launcher mLauncher;
private final Workspace mWorkspace;
- private final boolean mWorkspaceFadeInAdjacentScreens;
-
private float mNewScale;
public WorkspaceStateTransitionAnimation(Launcher launcher, Workspace workspace) {
mLauncher = launcher;
mWorkspace = workspace;
-
- DeviceProfile grid = mLauncher.getDeviceProfile();
- Resources res = launcher.getResources();
- mWorkspaceScrimAlpha = res.getInteger(R.integer.config_workspaceScrimAlpha);
- mWorkspaceFadeInAdjacentScreens = grid.shouldFadeAdjacentWorkspaceScreens();
+ mWorkspaceScrimAlpha = launcher.getResources()
+ .getInteger(R.integer.config_workspaceScrimAlpha);
}
public void setState(LauncherState toState) {
@@ -134,10 +129,10 @@ public class WorkspaceStateTransitionAnimation {
mNewScale = scaleAndTranslationY[0];
final float finalWorkspaceTranslationY = scaleAndTranslationY[1];
- int toPage = mWorkspace.getPageNearestToCenterOfScreen();
+ PageAlphaProvider pageAlphaProvider = state.getWorkspacePageAlphaProvider(mLauncher);
final int childCount = mWorkspace.getChildCount();
for (int i = 0; i < childCount; i++) {
- applyChildState(state, (CellLayout) mWorkspace.getChildAt(i), i, toPage,
+ applyChildState(state, (CellLayout) mWorkspace.getChildAt(i), i, pageAlphaProvider,
propertySetter);
}
@@ -151,21 +146,16 @@ public class WorkspaceStateTransitionAnimation {
}
public void applyChildState(LauncherState state, CellLayout cl, int childIndex) {
- applyChildState(state, cl, childIndex, mWorkspace.getPageNearestToCenterOfScreen(),
+ applyChildState(state, cl, childIndex, state.getWorkspacePageAlphaProvider(mLauncher),
NO_ANIM_PROPERTY_SETTER);
}
private void applyChildState(LauncherState state, CellLayout cl, int childIndex,
- int centerPage, PropertySetter propertySetter) {
+ PageAlphaProvider pageAlphaProvider, PropertySetter propertySetter) {
propertySetter.setInt(cl.getScrimBackground(),
DRAWABLE_ALPHA, state.hasScrim ? 255 : 0, Interpolators.ZOOM_IN);
-
- // 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, Interpolators.ZOOM_IN);
- }
+ propertySetter.setFloat(cl.getShortcutsAndWidgets(), View.ALPHA,
+ pageAlphaProvider.getPageAlpha(childIndex), Interpolators.DEACCEL_2);
}
public static class PropertySetter {