Search in sources :

Example 41 with Transition

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

the class ExitTransitionCoordinator method startSharedElementExit.

private void startSharedElementExit(final ViewGroup decorView) {
    Transition transition = getSharedElementExitTransition();
    transition.addListener(new Transition.TransitionListenerAdapter() {

        @Override
        public void onTransitionEnd(Transition transition) {
            transition.removeListener(this);
            if (isViewsTransitionComplete()) {
                delayCancel();
            }
        }
    });
    final ArrayList<View> sharedElementSnapshots = createSnapshots(mExitSharedElementBundle, mSharedElementNames);
    decorView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

        @Override
        public boolean onPreDraw() {
            decorView.getViewTreeObserver().removeOnPreDrawListener(this);
            setSharedElementState(mExitSharedElementBundle, sharedElementSnapshots);
            return true;
        }
    });
    setGhostVisibility(View.INVISIBLE);
    scheduleGhostVisibilityChange(View.INVISIBLE);
    if (mListener != null) {
        mListener.onSharedElementEnd(mSharedElementNames, mSharedElements, sharedElementSnapshots);
    }
    TransitionManager.beginDelayedTransition(decorView, transition);
    scheduleGhostVisibilityChange(View.VISIBLE);
    setGhostVisibility(View.VISIBLE);
    decorView.invalidate();
}
Also used : Transition(android.transition.Transition) View(android.view.View) ViewTreeObserver(android.view.ViewTreeObserver)

Example 42 with Transition

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

the class ExitTransitionCoordinator method getSharedElementExitTransition.

private Transition getSharedElementExitTransition() {
    Transition sharedElementTransition = null;
    if (!mSharedElements.isEmpty()) {
        sharedElementTransition = configureTransition(getSharedElementTransition(), false);
    }
    if (sharedElementTransition == null) {
        sharedElementTransitionComplete();
    } else {
        sharedElementTransition.addListener(new ContinueTransitionListener() {

            @Override
            public void onTransitionEnd(Transition transition) {
                transition.removeListener(this);
                sharedElementTransitionComplete();
                if (mIsHidden) {
                    showViews(mSharedElements, true);
                }
            }
        });
        mSharedElements.get(0).invalidate();
    }
    return sharedElementTransition;
}
Also used : Transition(android.transition.Transition)

Example 43 with Transition

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

the class ExitTransitionCoordinator method startExitTransition.

private void startExitTransition() {
    Transition transition = getExitTransition();
    ViewGroup decorView = getDecor();
    if (transition != null && decorView != null && mTransitioningViews != null) {
        setTransitioningViewsVisiblity(View.VISIBLE, false);
        TransitionManager.beginDelayedTransition(decorView, transition);
        setTransitioningViewsVisiblity(View.INVISIBLE, false);
        decorView.invalidate();
    } else {
        transitionStarted();
    }
}
Also used : ViewGroup(android.view.ViewGroup) Transition(android.transition.Transition)

Example 44 with Transition

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

the class Fragment method loadTransition.

private static Transition loadTransition(Context context, TypedArray typedArray, Transition currentValue, Transition defaultValue, int id) {
    if (currentValue != defaultValue) {
        return currentValue;
    }
    int transitionId = typedArray.getResourceId(id, 0);
    Transition transition = defaultValue;
    if (transitionId != 0 && transitionId != com.android.internal.R.transition.no_transition) {
        TransitionInflater inflater = TransitionInflater.from(context);
        transition = inflater.inflateTransition(transitionId);
        if (transition instanceof TransitionSet && ((TransitionSet) transition).getTransitionCount() == 0) {
            transition = null;
        }
    }
    return transition;
}
Also used : TransitionSet(android.transition.TransitionSet) Transition(android.transition.Transition) TransitionInflater(android.transition.TransitionInflater)

Example 45 with Transition

use of android.transition.Transition in project Douya by DreaminginCodeZH.

the class TransitionUtils method setEnterReturnExplode.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void setEnterReturnExplode(Fragment fragment) {
    if (!shouldEnableTransition()) {
        return;
    }
    Window window = fragment.getActivity().getWindow();
    Transition explode = new Explode().excludeTarget(android.R.id.statusBarBackground, true).excludeTarget(android.R.id.navigationBarBackground, true);
    window.setEnterTransition(explode);
    window.setReturnTransition(explode);
}
Also used : Window(android.view.Window) Explode(android.transition.Explode) Transition(android.transition.Transition) TargetApi(android.annotation.TargetApi)

Aggregations

Transition (android.transition.Transition)163 TransitionSet (android.transition.TransitionSet)57 View (android.view.View)51 ViewGroup (android.view.ViewGroup)36 ArrayList (java.util.ArrayList)23 TransitionInflater (android.transition.TransitionInflater)19 ViewTreeObserver (android.view.ViewTreeObserver)18 Fade (android.transition.Fade)17 ChangeBounds (android.transition.ChangeBounds)14 TextView (android.widget.TextView)11 TargetApi (android.annotation.TargetApi)10 Rect (android.graphics.Rect)10 List (java.util.List)10 AutoTransition (android.transition.AutoTransition)9 Scene (android.transition.Scene)8 ObjectAnimator (android.animation.ObjectAnimator)7 AdapterView (android.widget.AdapterView)6 ImageView (android.widget.ImageView)6 Animator (android.animation.Animator)5 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)5