@@ -0,0 +1,3107 @@
+// Copyright 2004-present Facebook. All Rights Reserved.%0A%0Apackage com.facebook.litho.animation;%0A%0Aimport java.util.concurrent.CopyOnWriteArrayList;%0A%0Aimport android.support.v4.util.SimpleArrayMap;%0A%0Aimport com.facebook.litho.internal.ArraySet;%0A%0A/**%0A * An %7B@link AnimationBinding%7D that's a sequence of other %7B@link AnimationBinding%7Ds.%0A */%0Apublic class SequenceBinding implements AnimationBinding %7B%0A%0A  private final CopyOnWriteArrayList%3CAnimationBindingListener%3E mListeners =%0A      new CopyOnWriteArrayList%3C%3E();%0A  private final AnimationBinding%5B%5D mBindings;%0A  private final AnimationBindingListener mChildListener;%0A  private Resolver mResolver;%0A  private int mCurrentIndex = 0;%0A  private boolean mIsActive = false;%0A%0A  public SequenceBinding(AnimationBinding... bindings) %7B%0A    mBindings = bindings;%0A%0A    if (mBindings.length == 0) %7B%0A      throw new IllegalArgumentException(%22Empty binding sequence%22);%0A    %7D%0A%0A    mChildListener = new AnimationBindingListener() %7B%0A      @Override%0A      public void onStart(AnimationBinding binding) %7B%0A      %7D%0A%0A      @Override%0A      public void onFinish(AnimationBinding binding) %7B%0A        SequenceBinding.this.onBindingFinished(binding);%0A      %7D%0A    %7D;%0A  %7D%0A%0A  private void onBindingFinished(AnimationBinding binding) %7B%0A    if (binding != mBindings%5BmCurrentIndex%5D) %7B%0A      throw new RuntimeException(%22Unexpected Binding completed%22);%0A    %7D%0A    binding.removeListener(mChildListener);%0A    mCurrentIndex++;%0A%0A    if (mCurrentIndex %3E= mBindings.length) %7B%0A      finish();%0A    %7D else %7B%0A      AnimationBinding next = mBindings%5BmCurrentIndex%5D;%0A      next.addListener(mChildListener);%0A      next.start(mResolver);%0A    %7D%0A  %7D%0A%0A  private void finish() %7B%0A    for (AnimationBindingListener listener : mListeners) %7B%0A      listener.onFinish(this);%0A    %7D%0A    mIsActive = false;%0A    mResolver = null;%0A  %7D%0A%0A  @Override%0A  public void start(Resolver resolver) %7B%0A    if (mIsActive) %7B%0A      throw new RuntimeException(%22Already started%22);%0A    %7D%0A    mIsActive = true;%0A    for (AnimationBindingListener listener : mListeners) %7B%0A      listener.onStart(this);%0A    %7D%0A    mResolver = resolver;%0A    mBindings%5B0%5D.addListener(mChildListener);%0A    mBindings%5B0%5D.start(mResolver);%0A  %7D%0A%0A  @Override%0A  public void stop() %7B%0A    if (!mIsActive) %7B%0A      return;%0A    %7D%0A    mIsActive = false;%0A    mBindings%5BmCurrentIndex%5D.stop();%0A  %7D%0A%0A  @Override%0A  public boolean isActive() %7B%0A    return mIsActive;%0A  %7D%0A%0A  @Override%0A  public void collectTransitioningProperties(ArraySet%3CComponentProperty%3E outSet) %7B%0A    for (int i = 0; i %3C mBindings.length; i++) %7B%0A      mBindings%5Bi%5D.collectTransitioningProperties(outSet);%0A    %7D%0A  %7D%0A%0A  @Override%0A  public void collectAppearFromValues(SimpleArrayMap%3CComponentProperty, LazyValue%3E outMap) %7B%0A    for (int i = 0; i %3C mBindings.length; i++) %7B%0A      mBindings%5Bi%5D.collectAppearFromValues(outMap);%0A    %7D%0A  %7D%0A%0A  @Override%0A  public void addListener(AnimationBindingListener animationBindingListener) %7B%0A    mListeners.add(animationBindingListener);%0A  %7D%0A%0A  @Override%0A  public void removeListener(AnimationBindingListener animationBindingListener) %7B%0A    mListeners.remove(animationBindingListener);%0A  %7D%0A%7D%0A

Add SequenceBinding