Add a way to get Transitions from a TransitionSet.

Bug 17113732

Change-Id: I0a157a59448e66560ba2252709971131c5dea401
This commit is contained in:
George Mount
2014-08-18 16:24:21 -07:00
parent fc12e6f1da
commit 7f15164ecb
3 changed files with 31 additions and 0 deletions

View File

@@ -32242,6 +32242,8 @@ package android.transition {
method public void captureEndValues(android.transition.TransitionValues);
method public void captureStartValues(android.transition.TransitionValues);
method public int getOrdering();
method public android.transition.Transition getTransitionAt(int);
method public int getTransitionCount();
method public android.transition.TransitionSet removeTransition(android.transition.Transition);
method public android.transition.TransitionSet setOrdering(int);
field public static final int ORDERING_SEQUENTIAL = 1; // 0x1

View File

@@ -150,6 +150,31 @@ public class TransitionSet extends Transition {
return this;
}
/**
* Returns the number of child transitions in the TransitionSet.
*
* @return The number of child transitions in the TransitionSet.
* @see #addTransition(Transition)
* @see #getTransitionAt(int)
*/
public int getTransitionCount() {
return mTransitions.size();
}
/**
* Returns the child Transition at the specified position in the TransitionSet.
*
* @param index The position of the Transition to retrieve.
* @see #addTransition(Transition)
* @see #getTransitionCount()
*/
public Transition getTransitionAt(int index) {
if (index < 0 || index >= mTransitions.size()) {
return null;
}
return mTransitions.get(index);
}
/**
* Setting a non-negative duration on a TransitionSet causes all of the child
* transitions (current and future) to inherit this duration.

View File

@@ -3559,6 +3559,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if (transitionId != -1 && transitionId != R.transition.no_transition) {
TransitionInflater inflater = TransitionInflater.from(getContext());
transition = inflater.inflateTransition(transitionId);
if (transition instanceof TransitionSet &&
((TransitionSet)transition).getTransitionCount() == 0) {
transition = null;
}
}
return transition;
}