Example usage for android.transition TransitionSet getTransitionCount

List of usage examples for android.transition TransitionSet getTransitionCount

Introduction

In this page you can find the example usage for android.transition TransitionSet getTransitionCount.

Prototype

public int getTransitionCount() 

Source Link

Document

Returns the number of child transitions in the TransitionSet.

Usage

From source file:Main.java

public static @Nullable Transition findTransition(@NonNull TransitionSet set,
        @NonNull Class<? extends Transition> clazz) {
    for (int i = 0; i < set.getTransitionCount(); i++) {
        Transition transition = set.getTransitionAt(i);
        if (transition.getClass() == clazz) {
            return transition;
        }/*from ww  w. j  a v a  2s.  c  o  m*/
        if (transition instanceof TransitionSet) {
            Transition child = findTransition((TransitionSet) transition, clazz);
            if (child != null)
                return child;
        }
    }
    return null;
}

From source file:Main.java

public static @Nullable Transition findTransition(@NonNull TransitionSet set,
        @NonNull Class<? extends Transition> clazz, @IdRes int targetId) {
    for (int i = 0; i < set.getTransitionCount(); i++) {
        Transition transition = set.getTransitionAt(i);
        if (transition.getClass() == clazz) {
            if (transition.getTargetIds().contains(targetId)) {
                return transition;
            }/*from   www.j a v  a 2s  .  com*/
        }
        if (transition instanceof TransitionSet) {
            Transition child = findTransition((TransitionSet) transition, clazz, targetId);
            if (child != null)
                return child;
        }
    }
    return null;
}