Example usage for android.transition ChangeImageTransform ChangeImageTransform

List of usage examples for android.transition ChangeImageTransform ChangeImageTransform

Introduction

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

Prototype

public ChangeImageTransform() 

Source Link

Usage

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

public ExitActivityTransition start(Bundle savedInstanceState) {
    if (interpolator == null) {
        interpolator = new DecelerateInterpolator();
    }//from   w w  w  . ja v  a  2s  . c  o 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);
}

From source file:net.huannguyen.conductorexample.transition.DetailPushTransChangeHandler.java

@NonNull
@Override/*  w  w w .  j  a  v  a  2 s .c o m*/
protected Transition getTransition(@NonNull ViewGroup container, @Nullable View from, @Nullable View to,
        boolean isPush) {

    if (to == null || !(to instanceof CountryDetailView)) {
        throw new IllegalArgumentException("The to view must be a CountryDetailView");
    }

    final CountryDetailView detailView = (CountryDetailView) to;

    detailView.flagView.setTransitionName(flagViewTransitionName);

    ChangeTransform changeTransform = new ChangeTransform();

    // Shared elements (the flag view in this case) are drawn in the window's view overlay during the transition by default.
    // That causes the favourite fab being drawn behind the flag when it is scaled up.
    // Setting the change transform not using overlay addresses this issue.
    changeTransform.setReparentWithOverlay(false);

    return new TransitionSet()
            .addTransition(new TransitionSet().addTransition(new ChangeBounds())
                    .addTransition(new ChangeClipBounds()).addTransition(changeTransform)
                    .addTransition(new ChangeImageTransform()).setDuration(300))
            .addTransition(new Slide().addTarget(detailView.detailGroup).setStartDelay(150))
            .addTransition(new Scale().addTarget(detailView.favouriteFab).setStartDelay(300))
            .setInterpolator(new FastOutSlowInInterpolator());
}