Search in sources :

Example 11 with Transition

use of android.transition.Transition in project ListenerMusicPlayer by hefuyicoder.

the class NavigationUtil method navigateToPlaylistDetail.

@TargetApi(21)
public static void navigateToPlaylistDetail(Activity context, long playlistID, String playlistName, long firstAlbumID, Pair<View, String> transitionViews) {
    FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager().beginTransaction();
    Fragment fragment;
    if (isLollipop() && transitionViews != null) {
        Transition changeImage = TransitionInflater.from(context).inflateTransition(R.transition.image_transform);
        transaction.addSharedElement(transitionViews.first, transitionViews.second);
        fragment = PlaylistDetailFragment.newInstance(playlistID, playlistName, firstAlbumID, true, transitionViews.second);
        fragment.setSharedElementEnterTransition(changeImage);
        fragment.setSharedElementReturnTransition(changeImage);
    } else {
        transaction.setCustomAnimations(R.anim.activity_fade_in, R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out);
        fragment = PlaylistDetailFragment.newInstance(playlistID, playlistName, firstAlbumID, false, transitionViews.second);
    }
    transaction.hide(((AppCompatActivity) context).getSupportFragmentManager().findFragmentById(R.id.fragment_container));
    transaction.add(R.id.fragment_container, fragment);
    transaction.addToBackStack(null).commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) Transition(android.transition.Transition) AppCompatActivity(android.support.v7.app.AppCompatActivity) PlaylistDetailFragment(io.hefuyi.listener.ui.fragment.PlaylistDetailFragment) ArtistDetailFragment(io.hefuyi.listener.ui.fragment.ArtistDetailFragment) Fragment(android.support.v4.app.Fragment) FolderSongsFragment(io.hefuyi.listener.ui.fragment.FolderSongsFragment) AlbumDetailFragment(io.hefuyi.listener.ui.fragment.AlbumDetailFragment) TargetApi(android.annotation.TargetApi)

Example 12 with Transition

use of android.transition.Transition in project iosched by google.

the class SessionDetailFragment method onAttach.

@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        final Transition sharedElementEnterTransition = activity.getWindow().getSharedElementEnterTransition();
        if (sharedElementEnterTransition != null) {
            mHasEnterTransition = true;
            sharedElementEnterTransition.addListener(new UIUtils.TransitionListenerAdapter() {

                @Override
                public void onTransitionStart(final Transition transition) {
                    enterTransitionStarted();
                }

                @Override
                public void onTransitionEnd(final Transition transition) {
                    enterTransitionFinished();
                }
            });
        }
        final Transition sharedElementReturnTransition = activity.getWindow().getSharedElementReturnTransition();
        if (sharedElementReturnTransition != null) {
            sharedElementReturnTransition.addListener(new UIUtils.TransitionListenerAdapter() {

                @Override
                public void onTransitionStart(final Transition transition) {
                    returnTransitionStarted();
                }
            });
        }
    }
}
Also used : Transition(android.transition.Transition) UIUtils(com.google.samples.apps.iosched.util.UIUtils)

Example 13 with Transition

use of android.transition.Transition in project Material-Animations by lgvalle.

the class RevealActivity method revealRed.

private void revealRed() {
    final ViewGroup.LayoutParams originalParams = btnRed.getLayoutParams();
    Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.changebounds_with_arcmotion);
    transition.addListener(new Transition.TransitionListener() {

        @Override
        public void onTransitionStart(Transition transition) {
        }

        @Override
        public void onTransitionEnd(Transition transition) {
            animateRevealColor(bgViewGroup, R.color.sample_red);
            body.setText(R.string.reveal_body3);
            body.setTextColor(ContextCompat.getColor(RevealActivity.this, R.color.theme_red_background));
            btnRed.setLayoutParams(originalParams);
        }

        @Override
        public void onTransitionCancel(Transition transition) {
        }

        @Override
        public void onTransitionPause(Transition transition) {
        }

        @Override
        public void onTransitionResume(Transition transition) {
        }
    });
    TransitionManager.beginDelayedTransition(bgViewGroup, transition);
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    btnRed.setLayoutParams(layoutParams);
}
Also used : ViewGroup(android.view.ViewGroup) Transition(android.transition.Transition) RelativeLayout(android.widget.RelativeLayout)

Example 14 with Transition

use of android.transition.Transition in project Material-Animations by lgvalle.

the class RevealActivity method setupExitAnimations.

private void setupExitAnimations() {
    Fade returnTransition = new Fade();
    getWindow().setReturnTransition(returnTransition);
    returnTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
    returnTransition.setStartDelay(getResources().getInteger(R.integer.anim_duration_medium));
    returnTransition.addListener(new Transition.TransitionListener() {

        @Override
        public void onTransitionStart(Transition transition) {
            transition.removeListener(this);
            animateButtonsOut();
            animateRevealHide(bgViewGroup);
        }

        @Override
        public void onTransitionEnd(Transition transition) {
        }

        @Override
        public void onTransitionCancel(Transition transition) {
        }

        @Override
        public void onTransitionPause(Transition transition) {
        }

        @Override
        public void onTransitionResume(Transition transition) {
        }
    });
}
Also used : Transition(android.transition.Transition) Fade(android.transition.Fade)

Example 15 with Transition

use of android.transition.Transition in project Material-Animations by lgvalle.

the class TransitionActivity3 method setupWindowAnimations.

private void setupWindowAnimations() {
    Transition transition;
    if (type == TYPE_PROGRAMMATICALLY) {
        transition = buildEnterTransition();
    } else {
        transition = TransitionInflater.from(this).inflateTransition(R.transition.slide_from_bottom);
    }
    getWindow().setEnterTransition(transition);
}
Also used : Transition(android.transition.Transition)

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