/*
 * Copyright (c) 2017-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */
package com.facebook.litho;

import com.facebook.litho.animation.AnimatedProperties;
import java.util.ArrayList;

/** Utilities to interact with {@link Transition}. */
class TransitionUtils {

  /**
   * @return whether the given Transition object specifies a bounds transition on the given
   *     transition key.
   */
  public static boolean hasBoundsAnimation(String transitionKey, Transition transition) {
    if (transition instanceof TransitionSet) {
      ArrayList<Transition> children = ((TransitionSet) transition).getChildren();
      for (int i = 0, size = children.size(); i < size; i++) {
        if (hasBoundsAnimation(transitionKey, children.get(i))) {
          return true;
        }
      }

      return false;
    }

    if (transition instanceof Transition.TransitionUnit) {
      final Transition.TransitionUnit transitionUnit = (Transition.TransitionUnit) transition;
      return transitionUnit.targetsKey(transitionKey)
          && (transitionUnit.targetsProperty(AnimatedProperties.HEIGHT));
    }

    throw new RuntimeException("Unhandled transition type: " + transition);
  }
}

@@ -1326,24 +1326,478 @@
 T));%0A    %7D%0A%0A
+    if (transition instanceof Transition.TransitionUnitsBuilder) %7B%0A      final Transition.TransitionUnitsBuilder builder =%0A          (Transition.TransitionUnitsBuilder) transition;%0A      ArrayList%3CTransition.TransitionUnit%3E units = builder.getTransitionUnits();%0A      for (int i = 0, size = units.size(); i %3C size; i++) %7B%0A        if (hasBoundsAnimation(transitionKey, units.get(i))) %7B%0A          return true;%0A        %7D%0A      %7D%0A%0A      return false;%0A    %7D%0A%0A
     throw ne

Handle TransitionUnitsBuilder in TransitionUtils.hasBoundsAnimation