Search in sources :

Example 1 with MorphButtonToDialog

use of com.hitherejoe.animate.util.MorphButtonToDialog in project animate by hitherejoe.

the class PopupActivity method setupSharedElementTransitionsButton.

public void setupSharedElementTransitionsButton(@NonNull Activity activity, @Nullable View target) {
    ArcMotion arcMotion = new ArcMotion();
    arcMotion.setMinimumHorizontalAngle(50f);
    arcMotion.setMinimumVerticalAngle(50f);
    int color = ContextCompat.getColor(activity, R.color.accent);
    Interpolator easeInOut = AnimationUtils.loadInterpolator(activity, android.R.interpolator.fast_out_slow_in);
    MorphButtonToDialog sharedEnter = new MorphButtonToDialog(color);
    sharedEnter.setPathMotion(arcMotion);
    sharedEnter.setInterpolator(easeInOut);
    MorphDialogToButton sharedReturn = new MorphDialogToButton(color);
    sharedReturn.setPathMotion(arcMotion);
    sharedReturn.setInterpolator(easeInOut);
    if (target != null) {
        sharedEnter.addTarget(target);
        sharedReturn.addTarget(target);
    }
    activity.getWindow().setSharedElementEnterTransition(sharedEnter);
    activity.getWindow().setSharedElementReturnTransition(sharedReturn);
}
Also used : MorphButtonToDialog(com.hitherejoe.animate.util.MorphButtonToDialog) MorphDialogToButton(com.hitherejoe.animate.util.MorphDialogToButton) Interpolator(android.view.animation.Interpolator) ArcMotion(android.transition.ArcMotion)

Aggregations

ArcMotion (android.transition.ArcMotion)1 Interpolator (android.view.animation.Interpolator)1 MorphButtonToDialog (com.hitherejoe.animate.util.MorphButtonToDialog)1 MorphDialogToButton (com.hitherejoe.animate.util.MorphDialogToButton)1