Example usage for android.view Window setSharedElementEnterTransition

List of usage examples for android.view Window setSharedElementEnterTransition

Introduction

In this page you can find the example usage for android.view Window setSharedElementEnterTransition.

Prototype

public void setSharedElementEnterTransition(Transition transition) 

Source Link

Document

Sets the Transition that will be used for shared elements transferred into the content Scene.

Usage

From source file:com.kogitune.activitytransition.ActivityTransition.java

public ExitActivityTransition start(Bundle savedInstanceState) {
    if (interpolator == null) {
        interpolator = new DecelerateInterpolator();
    }/*from  ww  w . j ava  2  s.  co m*/

    final Bundle bundle = fromIntent.getExtras();
    if (Build.VERSION.SDK_INT >= 21) {
        final TransitionData transitionData = new TransitionData(toView.getContext(), bundle);
        if (transitionData.imageFilePath != null) {
            TransitionAnimation.setImageToView(toView, transitionData.imageFilePath);
        }

        ViewCompat.setTransitionName(toView, toViewName);
        final Window window = ((Activity) context).getWindow();
        TransitionSet set = new TransitionSet();
        set.addTransition(new ChangeBounds());
        set.addTransition(new ChangeImageTransform());
        set.setInterpolator(interpolator);

        window.setSharedElementEnterTransition(set);
        window.setSharedElementReturnTransition(set);

        return new ExitActivityTransition(null);
    }
    final Context context = toView.getContext();
    final MoveData moveData = TransitionAnimation.startAnimation(context, toView, bundle, savedInstanceState,
            duration, interpolator);

    return new ExitActivityTransition(moveData);
}