summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2015-06-23 15:02:33 -0700
committerHyunyoung Song <hyunyoungs@google.com>2015-06-23 15:02:33 -0700
commit7eea78a1ed8a1e9ea7fabb5b203556bfa94a25fe (patch)
tree76a03a1757920bebbf4a43813850891e57558d3e /src
parente5106b687f6978bb8bb11ec90d7e8924a1b9e795 (diff)
downloadandroid_packages_apps_Trebuchet-7eea78a1ed8a1e9ea7fabb5b203556bfa94a25fe.tar.gz
android_packages_apps_Trebuchet-7eea78a1ed8a1e9ea7fabb5b203556bfa94a25fe.tar.bz2
android_packages_apps_Trebuchet-7eea78a1ed8a1e9ea7fabb5b203556bfa94a25fe.zip
Code cleanup, WorkspaceStateTransitionAnimation
Change-Id: I6b82f705f8dfddc507ddd66d5fd8a499cd6f58fd
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/WorkspaceStateTransitionAnimation.java36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index 399ef9755..b8916a72b 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -192,9 +192,6 @@ public class WorkspaceStateTransitionAnimation {
@Thunk final ZoomInInterpolator mZoomInInterpolator = new ZoomInInterpolator();
- // These properties refer to the background protection gradient used for AllApps and Widget tray.
- @Thunk ValueAnimator mBackgroundFadeOutAnimation;
-
@Thunk float mSpringLoadedShrinkFactor;
@Thunk float mOverviewModeShrinkFactor;
@Thunk float mWorkspaceScrimAlpha;
@@ -548,25 +545,29 @@ public class WorkspaceStateTransitionAnimation {
* @param animated whether or not to set the background alpha immediately
* @duration duration of the animation
*/
- private void animateBackgroundGradient(TransitionStates states, boolean animated, int duration) {
+ 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 =
+ // These properties refer to the background protection gradient used for AllApps
+ // and Widget tray.
+ ValueAnimator bgFadeOutAnimation =
LauncherAnimUtils.ofFloat(mWorkspace, startAlpha, finalAlpha);
- mBackgroundFadeOutAnimation.addUpdateListener(
- new ValueAnimator.AnimatorUpdateListener() {
+ bgFadeOutAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+ @Override
public void onAnimationUpdate(ValueAnimator animation) {
dragLayer.setBackgroundAlpha(
((Float)animation.getAnimatedValue()).floatValue());
}
});
- mBackgroundFadeOutAnimation.setInterpolator(new DecelerateInterpolator(1.5f));
- mBackgroundFadeOutAnimation.setDuration(duration);
- mStateAnimator.play(mBackgroundFadeOutAnimation);
+ bgFadeOutAnimation.setInterpolator(new DecelerateInterpolator(1.5f));
+ bgFadeOutAnimation.setDuration(duration);
+ mStateAnimator.play(bgFadeOutAnimation);
} else {
dragLayer.setBackgroundAlpha(finalAlpha);
}
@@ -577,17 +578,10 @@ public class WorkspaceStateTransitionAnimation {
* Cancels the current animation.
*/
private void cancelAnimation() {
- cancelAnimator(mStateAnimator);
- mStateAnimator = null;
- }
-
- /**
- * Cancels the specified animation.
- */
- private void cancelAnimator(Animator animator) {
- if (animator != null) {
- animator.setDuration(0);
- animator.cancel();
+ if (mStateAnimator != null) {
+ mStateAnimator.setDuration(0);
+ mStateAnimator.cancel();
}
+ mStateAnimator = null;
}
} \ No newline at end of file