Search in sources :

Example 91 with Transition

use of android.transition.Transition in project Conductor by bluelinelabs.

the class TransitionUtils method mergeTransitions.

@NonNull
public static TransitionSet mergeTransitions(int ordering, Transition... transitions) {
    TransitionSet transitionSet = new TransitionSet();
    for (Transition transition : transitions) {
        if (transition != null) {
            transitionSet.addTransition(transition);
        }
    }
    transitionSet.setOrdering(ordering);
    return transitionSet;
}
Also used : TransitionSet(android.transition.TransitionSet) Transition(android.transition.Transition) NonNull(android.support.annotation.NonNull)

Example 92 with Transition

use of android.transition.Transition in project Conductor by bluelinelabs.

the class TransitionUtils method addTargets.

public static void addTargets(@Nullable Transition transition, @NonNull List<View> views) {
    if (transition == null) {
        return;
    }
    if (transition instanceof TransitionSet) {
        TransitionSet set = (TransitionSet) transition;
        int numTransitions = set.getTransitionCount();
        for (int i = 0; i < numTransitions; i++) {
            Transition child = set.getTransitionAt(i);
            addTargets(child, views);
        }
    } else if (!hasSimpleTarget(transition)) {
        List<View> targets = transition.getTargets();
        if (isNullOrEmpty(targets)) {
            int numViews = views.size();
            for (int i = 0; i < numViews; i++) {
                transition.addTarget(views.get(i));
            }
        }
    }
}
Also used : TransitionSet(android.transition.TransitionSet) Transition(android.transition.Transition) List(java.util.List)

Example 93 with Transition

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

the class NavigationUtil method navigateToAlbum.

@TargetApi(21)
public static void navigateToAlbum(Activity context, long albumID, String albumName, 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 = AlbumDetailFragment.newInstance(albumID, albumName, 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 = AlbumDetailFragment.newInstance(albumID, albumName, false, null);
    }
    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 94 with Transition

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

the class NavigationUtil method navigateToArtist.

@TargetApi(21)
public static void navigateToArtist(Activity context, long artistID, String name, Pair<View, String> transitionViews) {
    FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager().beginTransaction();
    Fragment fragment;
    if (ListenerUtil.isLollipop() && transitionViews != null) {
        Transition changeImage = TransitionInflater.from(context).inflateTransition(R.transition.image_transform);
        transaction.addSharedElement(transitionViews.first, transitionViews.second);
        fragment = ArtistDetailFragment.newInstance(artistID, name, 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 = ArtistDetailFragment.newInstance(artistID, name, false, null);
    }
    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 95 with Transition

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

the class RevealActivity method setupEnterAnimations.

private void setupEnterAnimations() {
    Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.changebounds_with_arcmotion);
    getWindow().setSharedElementEnterTransition(transition);
    transition.addListener(new Transition.TransitionListener() {

        @Override
        public void onTransitionStart(Transition transition) {
        }

        @Override
        public void onTransitionEnd(Transition transition) {
            // Removing listener here is very important because shared element transition is executed again backwards on exit. If we don't remove the listener this code will be triggered again.
            transition.removeListener(this);
            hideTarget();
            animateRevealShow(toolbar);
            animateButtonsIn();
        }

        @Override
        public void onTransitionCancel(Transition transition) {
        }

        @Override
        public void onTransitionPause(Transition transition) {
        }

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

Aggregations

Transition (android.transition.Transition)176 TransitionSet (android.transition.TransitionSet)62 View (android.view.View)54 ViewGroup (android.view.ViewGroup)37 ArrayList (java.util.ArrayList)23 TransitionInflater (android.transition.TransitionInflater)19 Fade (android.transition.Fade)18 ViewTreeObserver (android.view.ViewTreeObserver)18 ChangeBounds (android.transition.ChangeBounds)17 Rect (android.graphics.Rect)12 List (java.util.List)12 TargetApi (android.annotation.TargetApi)11 TextView (android.widget.TextView)11 AutoTransition (android.transition.AutoTransition)10 Scene (android.transition.Scene)8 ObjectAnimator (android.animation.ObjectAnimator)7 Fragment (android.support.v4.app.Fragment)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)6 AdapterView (android.widget.AdapterView)6 ImageView (android.widget.ImageView)6