Commit a340744f authored by Marcin Wiacek's avatar Marcin Wiacek Committed by Commit Bot

Migrate StackLayoutBase (migration to CompositorAnimator, part 3)

This is part of changes which put as goal removing redundant ChromeAnimation API by moving everything into CompositorAnimator.

Public doc with proposal: https://docs.google.com/document/d/1VL5ntE7vn267IFjE4Zke0GkhVVTHz1bEP672Apj_E2k/edit

This concrete patch is migrating StackLayoutBase.

BUG=890643

Change-Id: I66668b9373c54fc9573de8d797990b6e291f2b54
Reviewed-on: https://chromium-review.googlesource.com/c/1376851Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Commit-Queue: Marcin Wiącek <marcin@mwiacek.com>
Cr-Commit-Position: refs/heads/master@{#619739}
parent a75f00e5
......@@ -45,6 +45,8 @@ public class CompositorAnimator extends Animator {
/** The list of frame update listeners for this animation. */
private final ArrayList<AnimatorUpdateListener> mAnimatorUpdateListeners = new ArrayList<>();
private FloatProperty mFloatProperty;
/**
* A cached copy of the list of {@link AnimatorUpdateListener}s to prevent allocating a new list
* every update.
......@@ -135,6 +137,7 @@ public class CompositorAnimator extends Animator {
animator.setDuration(durationMs);
animator.addUpdateListener(
(CompositorAnimator a) -> property.setValue(target, a.getAnimatedValue()));
animator.setFloatProperty(property);
animator.setInterpolator(interpolator);
return animator;
}
......@@ -229,6 +232,17 @@ public class CompositorAnimator extends Animator {
mAnimatorUpdateListeners.add(listener);
}
private void setFloatProperty(FloatProperty property) {
mFloatProperty = property;
}
/**
* @return Whether this animation is of the given FloatProperty.
*/
public boolean isOfFloatProperty(FloatProperty property) {
return mFloatProperty == property;
}
/**
* @return Whether or not the animation has ended after being started. If the animation is
* started after ending, this value will be reset to true.
......@@ -270,6 +284,7 @@ public class CompositorAnimator extends Animator {
public void removeAllListeners() {
mListeners.clear();
mAnimatorUpdateListeners.clear();
mFloatProperty = null;
}
@Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment