Search in sources :

Example 61 with TransitionSet

use of android.transition.TransitionSet in project android_frameworks_base by crdroidandroid.

the class Demo3 method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search_screen);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this);
    mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this);
    TransitionSet transition = new TransitionSet();
    transition.addTransition(new Fade()).addTransition(new ChangeBounds()).addTransition(new Recolor());
    mTransitionManager = new TransitionManager();
    mTransitionManager.setTransition(mSearchScreen, transition);
    mTransitionManager.setTransition(mResultsScreen, transition);
}
Also used : TransitionManager(android.transition.TransitionManager) TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) View(android.view.View) Fade(android.transition.Fade) Recolor(android.transition.Recolor)

Example 62 with TransitionSet

use of android.transition.TransitionSet in project android_frameworks_base by crdroidandroid.

the class Demo4 method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search_screen);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mSearchScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.search_screen, this);
    mResultsScreen = Scene.getSceneForLayout(mSceneRoot, R.layout.results_screen, this);
    TransitionSet transitionToResults = new TransitionSet();
    Fade fade = new Fade();
    fade.addTarget(R.id.resultsText).addTarget(R.id.resultsList);
    fade.setStartDelay(300);
    fade.setDuration(1000);
    transitionToResults.addTransition(fade).addTransition(new ChangeBounds().addTarget(R.id.searchContainer)).addTransition(new Recolor().addTarget(R.id.container));
    TransitionSet transitionToSearch = new TransitionSet();
    transitionToSearch.addTransition(fade).addTransition(new ChangeBounds().addTarget(R.id.searchContainer)).addTransition(new Recolor().addTarget(R.id.container));
    mTransitionManager = new TransitionManager();
    mTransitionManager.setTransition(mSearchScreen, transitionToSearch);
    mTransitionManager.setTransition(mResultsScreen, transitionToResults);
}
Also used : TransitionManager(android.transition.TransitionManager) TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) View(android.view.View) Fade(android.transition.Fade) Recolor(android.transition.Recolor)

Example 63 with TransitionSet

use of android.transition.TransitionSet in project android_frameworks_base by crdroidandroid.

the class ChangingText method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.changing_text_1);
    View container = findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.changing_text_1, this);
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.changing_text_2, this);
    mChanger = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER);
    mChanger.addTransition(new ChangeBounds()).addTransition(new ChangeText());
    mCurrentScene = mScene1;
}
Also used : ChangeText(android.transition.ChangeText) TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) View(android.view.View)

Example 64 with TransitionSet

use of android.transition.TransitionSet in project android_frameworks_base by AOSPA.

the class BackStackRecord method mergeTransitions.

private static Transition mergeTransitions(Transition enterTransition, Transition exitTransition, Transition sharedElementTransition, Fragment inFragment, boolean isBack) {
    boolean overlap = true;
    if (enterTransition != null && exitTransition != null && inFragment != null) {
        overlap = isBack ? inFragment.getAllowReturnTransitionOverlap() : inFragment.getAllowEnterTransitionOverlap();
    }
    // Wrap the transitions. Explicit targets like in enter and exit will cause the
    // views to be targeted regardless of excluded views. If that happens, then the
    // excluded fragments views (hidden fragments) will still be in the transition.
    Transition transition;
    if (overlap) {
        // Regular transition -- do it all together
        TransitionSet transitionSet = new TransitionSet();
        if (enterTransition != null) {
            transitionSet.addTransition(enterTransition);
        }
        if (exitTransition != null) {
            transitionSet.addTransition(exitTransition);
        }
        if (sharedElementTransition != null) {
            transitionSet.addTransition(sharedElementTransition);
        }
        transition = transitionSet;
    } else {
        // First do exit, then enter, but allow shared element transition to happen
        // during both.
        Transition staggered = null;
        if (exitTransition != null && enterTransition != null) {
            staggered = new TransitionSet().addTransition(exitTransition).addTransition(enterTransition).setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
        } else if (exitTransition != null) {
            staggered = exitTransition;
        } else if (enterTransition != null) {
            staggered = enterTransition;
        }
        if (sharedElementTransition != null) {
            TransitionSet together = new TransitionSet();
            if (staggered != null) {
                together.addTransition(staggered);
            }
            together.addTransition(sharedElementTransition);
            transition = together;
        } else {
            transition = staggered;
        }
    }
    return transition;
}
Also used : TransitionSet(android.transition.TransitionSet) Transition(android.transition.Transition)

Example 65 with TransitionSet

use of android.transition.TransitionSet in project android_frameworks_base by AOSPA.

the class BackStackRecord method getSharedElementTransition.

private static TransitionSet getSharedElementTransition(Fragment inFragment, Fragment outFragment, boolean isBack) {
    if (inFragment == null || outFragment == null) {
        return null;
    }
    Transition transition = cloneTransition(isBack ? outFragment.getSharedElementReturnTransition() : inFragment.getSharedElementEnterTransition());
    if (transition == null) {
        return null;
    }
    TransitionSet transitionSet = new TransitionSet();
    transitionSet.addTransition(transition);
    return transitionSet;
}
Also used : TransitionSet(android.transition.TransitionSet) Transition(android.transition.Transition)

Aggregations

TransitionSet (android.transition.TransitionSet)127 ChangeBounds (android.transition.ChangeBounds)71 View (android.view.View)66 Transition (android.transition.Transition)57 Fade (android.transition.Fade)47 TransitionManager (android.transition.TransitionManager)32 Recolor (android.transition.Recolor)24 Crossfade (android.transition.Crossfade)20 ViewGroup (android.view.ViewGroup)17 TransitionInflater (android.transition.TransitionInflater)15 ArrayList (java.util.ArrayList)15 ChangeText (android.transition.ChangeText)12 TextView (android.widget.TextView)12 List (java.util.List)10 ImageView (android.widget.ImageView)9 Scene (android.transition.Scene)8 Visibility (android.transition.Visibility)5 GhostView (android.view.GhostView)5 AutoTransition (android.transition.AutoTransition)4 Rotate (android.transition.Rotate)4