Search in sources :

Example 16 with TransitionSet

use of android.transition.TransitionSet in project platform_frameworks_base by android.

the class BackStackRecord method getSharedElementTransition.

private static TransitionSet getSharedElementTransition(Fragment inFragment, Fragment outFragment, boolean isBack) {
    if (inFragment == null || outFragment == null) {
        return null;
    }
    Transition transition = cloneTransition(isBack ? outFragment.getSharedElementReturnTransition() : inFragment.getSharedElementEnterTransition());
    if (transition == null) {
        return null;
    }
    TransitionSet transitionSet = new TransitionSet();
    transitionSet.addTransition(transition);
    return transitionSet;
}
Also used : TransitionSet(android.transition.TransitionSet) Transition(android.transition.Transition)

Example 17 with TransitionSet

use of android.transition.TransitionSet in project platform_frameworks_base by android.

the class BackStackRecord method addTargets.

/**
     * This method adds views as targets to the transition, but only if the transition
     * doesn't already have a target. It is best for views to contain one View object
     * that does not exist in the view hierarchy (state.nonExistentView) so that
     * when they are removed later, a list match will suffice to remove the targets.
     * Otherwise, if you happened to have targeted the exact views for the transition,
     * the removeTargets call will remove them unexpectedly.
     */
public static void addTargets(Transition transition, ArrayList<View> views) {
    if (transition instanceof TransitionSet) {
        TransitionSet set = (TransitionSet) transition;
        int numTransitions = set.getTransitionCount();
        for (int i = 0; i < numTransitions; i++) {
            Transition child = set.getTransitionAt(i);
            addTargets(child, views);
        }
    } else if (!hasSimpleTarget(transition)) {
        List<View> targets = transition.getTargets();
        if (isNullOrEmpty(targets)) {
            // We can just add the target views
            int numViews = views.size();
            for (int i = 0; i < numViews; i++) {
                transition.addTarget(views.get(i));
            }
        }
    }
}
Also used : TransitionSet(android.transition.TransitionSet) Transition(android.transition.Transition) ArrayList(java.util.ArrayList) List(java.util.List)

Example 18 with TransitionSet

use of android.transition.TransitionSet in project platform_frameworks_base by android.

the class ActivityTransitionCoordinator method setTargets.

protected Transition setTargets(Transition transition, boolean add) {
    if (transition == null || (add && (mTransitioningViews == null || mTransitioningViews.isEmpty()))) {
        return null;
    }
    // Add the targets to a set containing transition so that transition
    // remains unaffected. We don't want to modify the targets of transition itself.
    TransitionSet set = new TransitionSet();
    if (mTransitioningViews != null) {
        for (int i = mTransitioningViews.size() - 1; i >= 0; i--) {
            View view = mTransitioningViews.get(i);
            if (add) {
                set.addTarget(view);
            } else {
                set.excludeTarget(view, true);
            }
        }
    }
    // By adding the transition after addTarget, we prevent addTarget from
    // affecting transition.
    set.addTransition(transition);
    if (!add && mTransitioningViews != null && !mTransitioningViews.isEmpty()) {
        // Allow children of excluded transitioning views, but not the views themselves
        set = new TransitionSet().addTransition(set);
    }
    return set;
}
Also used : TransitionSet(android.transition.TransitionSet) ImageView(android.widget.ImageView) GhostView(android.view.GhostView) View(android.view.View)

Example 19 with TransitionSet

use of android.transition.TransitionSet in project platform_frameworks_base by android.

the class PopupWindow method getTransition.

private Transition getTransition(int resId) {
    if (resId != 0 && resId != R.transition.no_transition) {
        final TransitionInflater inflater = TransitionInflater.from(mContext);
        final Transition transition = inflater.inflateTransition(resId);
        if (transition != null) {
            final boolean isEmpty = transition instanceof TransitionSet && ((TransitionSet) transition).getTransitionCount() == 0;
            if (!isEmpty) {
                return transition;
            }
        }
    }
    return null;
}
Also used : TransitionSet(android.transition.TransitionSet) Transition(android.transition.Transition) TransitionInflater(android.transition.TransitionInflater)

Example 20 with TransitionSet

use of android.transition.TransitionSet in project android_frameworks_base by ResurrectionRemix.

the class CrossfadeMultiple method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.crossfade_multiple);
    ViewGroup container = (ViewGroup) findViewById(R.id.container);
    mSceneRoot = container;
    mButton = (Button) findViewById(R.id.button);
    mImageView = (ImageView) findViewById(R.id.imageview);
    mTextView = (TextView) findViewById(R.id.textview);
    mCrossfade = new Crossfade();
    mCrossfade.addTarget(R.id.button).addTarget(R.id.textview).addTarget(R.id.imageview);
    mCrossfadeGroup = new TransitionSet();
    mCrossfadeGroup.setDuration(300);
    mCrossfadeGroup.addTransition(mCrossfade).addTransition(new ChangeBounds());
    mTransition = mCrossfadeGroup;
    mInOutGroup = new TransitionSet();
    Crossfade inOut = new Crossfade();
    inOut.setDuration(300);
    inOut.setFadeBehavior(Crossfade.FADE_BEHAVIOR_OUT_IN);
    ChangeBounds changeBounds = new ChangeBounds();
    changeBounds.setStartDelay(150);
    changeBounds.setDuration(0);
    mInOutGroup.addTransition(inOut).addTransition(changeBounds);
    mTextChangeGroup1 = new TransitionSet();
    ChangeText changeTextInOut = new ChangeText();
    changeTextInOut.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN);
    mTextChangeGroup1.addTransition(changeTextInOut).addTransition(new ChangeBounds());
    mTextChangeGroup2 = new TransitionSet();
    mTextChangeGroup2.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
    ChangeText changeTextOut = new ChangeText();
    changeTextOut.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT);
    mTextChangeGroup2.addTransition(changeTextOut).addTransition(new ChangeBounds());
    mTextChangeGroup3 = new TransitionSet();
    mTextChangeGroup3.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
    ChangeText changeTextIn = new ChangeText();
    changeTextIn.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_IN);
    mTextChangeGroup3.addTransition(changeTextIn).addTransition(new ChangeBounds());
}
Also used : ChangeText(android.transition.ChangeText) TransitionSet(android.transition.TransitionSet) ViewGroup(android.view.ViewGroup) ChangeBounds(android.transition.ChangeBounds) Crossfade(android.transition.Crossfade)

Aggregations

TransitionSet (android.transition.TransitionSet)127 ChangeBounds (android.transition.ChangeBounds)71 View (android.view.View)66 Transition (android.transition.Transition)57 Fade (android.transition.Fade)47 TransitionManager (android.transition.TransitionManager)32 Recolor (android.transition.Recolor)24 Crossfade (android.transition.Crossfade)20 ViewGroup (android.view.ViewGroup)17 TransitionInflater (android.transition.TransitionInflater)15 ArrayList (java.util.ArrayList)15 ChangeText (android.transition.ChangeText)12 TextView (android.widget.TextView)12 List (java.util.List)10 ImageView (android.widget.ImageView)9 Scene (android.transition.Scene)8 Visibility (android.transition.Visibility)5 GhostView (android.view.GhostView)5 AutoTransition (android.transition.AutoTransition)4 Rotate (android.transition.Rotate)4