summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2015-06-19 18:03:35 -0700
committerHyunyoung Song <hyunyoungs@google.com>2015-06-19 18:03:35 -0700
commit5796b03f6d526ee775fa48f175ceee0e92200b45 (patch)
tree77dc49471e3d7ec3679bcca91a429aba89d061bd /src
parente91a14c6986660253996018982d500a728585199 (diff)
downloadandroid_packages_apps_Trebuchet-5796b03f6d526ee775fa48f175ceee0e92200b45.tar.gz
android_packages_apps_Trebuchet-5796b03f6d526ee775fa48f175ceee0e92200b45.tar.bz2
android_packages_apps_Trebuchet-5796b03f6d526ee775fa48f175ceee0e92200b45.zip
Add workspace scrim animation to the state transition to reduce jankiness.
b/20956087 Note: Will work on creating a separate view for the scrim animation rather than the drag layer on a separate CL. Change-Id: Idaced5c6867abe3ed9afa984c885023676b3a141
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/WorkspaceStateTransitionAnimation.java26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index 13e4a59f1..399ef9755 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -192,8 +192,7 @@ public class WorkspaceStateTransitionAnimation {
@Thunk final ZoomInInterpolator mZoomInInterpolator = new ZoomInInterpolator();
- // These properties refer to the background protection gradient used for AllApps and Customize
- @Thunk ValueAnimator mBackgroundFadeInAnimation;
+ // These properties refer to the background protection gradient used for AllApps and Widget tray.
@Thunk ValueAnimator mBackgroundFadeOutAnimation;
@Thunk float mSpringLoadedShrinkFactor;
@@ -232,6 +231,7 @@ public class WorkspaceStateTransitionAnimation {
accessibilityEnabled);
animateSearchBar(states, animated, duration, hasOverlaySearchBar, layerViews,
accessibilityEnabled);
+ animateBackgroundGradient(states, animated, BACKGROUND_FADE_OUT_DURATION);
return mStateAnimator;
}
@@ -473,12 +473,6 @@ public class WorkspaceStateTransitionAnimation {
AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
}
}
-
- if (states.stateIsNormal) {
- animateBackgroundGradient(0f, animated);
- } else {
- animateBackgroundGradient(mWorkspaceScrimAlpha, animated);
- }
}
/**
@@ -548,19 +542,17 @@ public class WorkspaceStateTransitionAnimation {
}
/**
- * Animates the background scrim.
- * TODO(winsonc): Is there a better place for this?
+ * Animates the background scrim. Add to the state animator to prevent jankiness.
*
* @param finalAlpha the final alpha for the background scrim
* @param animated whether or not to set the background alpha immediately
+ * @duration duration of the animation
*/
- private void animateBackgroundGradient(float finalAlpha, boolean animated) {
- // Cancel any running background animations
- cancelAnimator(mBackgroundFadeInAnimation);
- cancelAnimator(mBackgroundFadeOutAnimation);
-
+ private void animateBackgroundGradient(TransitionStates states, boolean animated, int duration) {
final DragLayer dragLayer = mLauncher.getDragLayer();
final float startAlpha = dragLayer.getBackgroundAlpha();
+ float finalAlpha = states.stateIsNormal ? 0 : mWorkspaceScrimAlpha;
+
if (finalAlpha != startAlpha) {
if (animated) {
mBackgroundFadeOutAnimation =
@@ -573,8 +565,8 @@ public class WorkspaceStateTransitionAnimation {
}
});
mBackgroundFadeOutAnimation.setInterpolator(new DecelerateInterpolator(1.5f));
- mBackgroundFadeOutAnimation.setDuration(BACKGROUND_FADE_OUT_DURATION);
- mBackgroundFadeOutAnimation.start();
+ mBackgroundFadeOutAnimation.setDuration(duration);
+ mStateAnimator.play(mBackgroundFadeOutAnimation);
} else {
dragLayer.setBackgroundAlpha(finalAlpha);
}