Example usage for android.transition TransitionSet getTransitionAt

List of usage examples for android.transition TransitionSet getTransitionAt

Introduction

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

Prototype

public Transition getTransitionAt(int index) 

Source Link

Document

Returns the child Transition at the specified position 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 w ww .j a  va 2 s .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  av  a  2  s  . c  o  m
        }
        if (transition instanceof TransitionSet) {
            Transition child = findTransition((TransitionSet) transition, clazz, targetId);
            if (child != null)
                return child;
        }
    }
    return null;
}