Search in sources :

Example 26 with TransitionSet

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

the class BackStackRecord method addTargets.

/**
     * This method adds views as targets to the transition, but only if the transition
     * doesn't already have a target. It is best for views to contain one View object
     * that does not exist in the view hierarchy (state.nonExistentView) so that
     * when they are removed later, a list match will suffice to remove the targets.
     * Otherwise, if you happened to have targeted the exact views for the transition,
     * the removeTargets call will remove them unexpectedly.
     */
public static void addTargets(Transition transition, ArrayList<View> views) {
    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)) {
            // We can just add the target views
            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) ArrayList(java.util.ArrayList) List(java.util.List)

Example 27 with TransitionSet

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

the class LoginActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mLoginScene = Scene.getSceneForLayout(mSceneRoot, R.layout.activity_login, this);
    mPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.login_password, this);
    mIncorrectPasswordScene = Scene.getSceneForLayout(mSceneRoot, R.layout.incorrect_password, this);
    mUsernameTakenScene = Scene.getSceneForLayout(mSceneRoot, R.layout.username_taken, this);
    mSuccessScene = Scene.getSceneForLayout(mSceneRoot, R.layout.success, this);
    mNewUserScene = Scene.getSceneForLayout(mSceneRoot, R.layout.new_user, this);
    mTransitionManager = new TransitionManager();
    // Custom transitions in/out of NewUser screen - slide in the 2nd password UI
    TransitionSet slider = new TransitionSet();
    slider.addTransition(new Slide().addTarget(R.id.retype).addTarget(R.id.retypeEdit));
    slider.addTransition(new Recolor().addTarget(R.id.password).addTarget(R.id.passwordEdit));
    slider.addTransition(new Fade());
    mTransitionManager.setTransition(mLoginScene, mNewUserScene, slider);
    mTransitionManager.setTransition(mPasswordScene, mNewUserScene, slider);
    mTransitionManager.setTransition(mNewUserScene, mLoginScene, slider);
    mTransitionManager.setTransition(mNewUserScene, mPasswordScene, slider);
    // Custom transitions with recoloring password field
    Transition colorizer = new Recolor().addTarget(R.id.password).addTarget(R.id.passwordEdit);
    mTransitionManager.setTransition(mLoginScene, mPasswordScene, colorizer);
    mTransitionManager.setTransition(mPasswordScene, mLoginScene, colorizer);
    mCurrentScene = mLoginScene;
}
Also used : TransitionManager(android.transition.TransitionManager) TransitionSet(android.transition.TransitionSet) Slide(android.transition.Slide) Transition(android.transition.Transition) TextView(android.widget.TextView) View(android.view.View) Fade(android.transition.Fade) Recolor(android.transition.Recolor)

Example 28 with TransitionSet

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

the class ScenesTestAutoTargets 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 29 with TransitionSet

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

the class HierarchicalMove method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.hierarchical_move);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    buttons[0] = (Button) findViewById(R.id.button0);
    buttons[1] = (Button) findViewById(R.id.button1);
    buttons[2] = (Button) findViewById(R.id.button2);
    buttons[3] = (Button) findViewById(R.id.button3);
    buttons[4] = (Button) findViewById(R.id.button4);
    buttons[5] = (Button) findViewById(R.id.button5);
    // Move button0, then buttons 1/2 together, then buttons 3/4/5 sequentially:
    // group (seq)
    //    Move 0
    //    group (seq)
    //       group (together)
    //          Move 1
    //          Move 2
    //       group (sequentially)
    //          Move 3
    //          Move 4/5
    TransitionSet rootTransition = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
    // button0
    Transition move0 = new ChangeBounds();
    move0.addTarget(buttons[0]);
    // buttons 1/2/3/4/5
    TransitionSet group12345 = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
    // buttons 1/2
    TransitionSet group12 = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER);
    ChangeBounds changeBounds1 = new ChangeBounds();
    changeBounds1.addTarget(buttons[1]);
    ChangeBounds changeBounds2 = new ChangeBounds();
    changeBounds2.addTarget(buttons[2]);
    group12.addTransition(changeBounds1).addTransition(changeBounds2);
    TransitionSet group345 = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
    ChangeBounds changeBounds3 = new ChangeBounds();
    changeBounds3.addTarget(buttons[3]);
    ChangeBounds changeBounds45 = new ChangeBounds();
    changeBounds45.addTarget(buttons[4]).addTarget(buttons[5]);
    group345.addTransition(changeBounds3).addTransition(changeBounds45);
    group12345.addTransition(move0).addTransition(group12).addTransition(group345);
    rootTransition.addTransition(group12345);
    rootTransition.setDuration(1000);
    mTransition = rootTransition;
}
Also used : TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) Transition(android.transition.Transition) View(android.view.View)

Example 30 with TransitionSet

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

the class SequenceTest method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fading_test);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mRemovingButton = (Button) findViewById(R.id.removingButton);
    mInvisibleButton = (Button) findViewById(R.id.invisibleButton);
    mGoneButton = (Button) findViewById(R.id.goneButton);
    mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.fading_test, this);
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.fading_test_scene_2, this);
    Transition fade1 = new Fade().addTarget(R.id.removingButton);
    Transition fade2 = new Fade().addTarget(R.id.invisibleButton);
    Transition fade3 = new Fade().addTarget(R.id.goneButton);
    TransitionSet fader = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
    fader.addTransition(fade1).addTransition(fade2).addTransition(fade3).addTransition(new ChangeBounds());
    sequencedFade = fader;
    reverseSequencedFade = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
    reverseSequencedFade.addTransition(new ChangeBounds()).addTransition(fade3).addTransition(fade2).addTransition(fade1);
    mCurrentScene = mScene1;
}
Also used : TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) Transition(android.transition.Transition) View(android.view.View) Fade(android.transition.Fade)

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