Search in sources :

Example 51 with TransitionSet

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

the class ActivityTransitionCoordinator method setTargets.

protected Transition setTargets(Transition transition, boolean add) {
    if (transition == null || (add && (mTransitioningViews == null || mTransitioningViews.isEmpty()))) {
        return null;
    }
    // Add the targets to a set containing transition so that transition
    // remains unaffected. We don't want to modify the targets of transition itself.
    TransitionSet set = new TransitionSet();
    if (mTransitioningViews != null) {
        for (int i = mTransitioningViews.size() - 1; i >= 0; i--) {
            View view = mTransitioningViews.get(i);
            if (add) {
                set.addTarget(view);
            } else {
                set.excludeTarget(view, true);
            }
        }
    }
    // By adding the transition after addTarget, we prevent addTarget from
    // affecting transition.
    set.addTransition(transition);
    if (!add && mTransitioningViews != null && !mTransitioningViews.isEmpty()) {
        // Allow children of excluded transitioning views, but not the views themselves
        set = new TransitionSet().addTransition(set);
    }
    return set;
}
Also used : TransitionSet(android.transition.TransitionSet) ImageView(android.widget.ImageView) GhostView(android.view.GhostView) View(android.view.View)

Example 52 with TransitionSet

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

the class ActivityTransitionCoordinator method noLayoutSuppressionForVisibilityTransitions.

/**
     * Blocks suppressLayout from Visibility transitions. It is ok to suppress the layout,
     * but we don't want to force the layout when suppressLayout becomes false. This leads
     * to visual glitches.
     */
private static void noLayoutSuppressionForVisibilityTransitions(Transition transition) {
    if (transition instanceof Visibility) {
        final Visibility visibility = (Visibility) transition;
        visibility.setSuppressLayout(false);
    } else if (transition instanceof TransitionSet) {
        final TransitionSet set = (TransitionSet) transition;
        final int count = set.getTransitionCount();
        for (int i = 0; i < count; i++) {
            noLayoutSuppressionForVisibilityTransitions(set.getTransitionAt(i));
        }
    }
}
Also used : TransitionSet(android.transition.TransitionSet) Visibility(android.transition.Visibility)

Example 53 with TransitionSet

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

the class SurfaceAndTextureViews method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.surface_texture_views);
    final ViewGroup container = (ViewGroup) findViewById(R.id.container);
    Button toggleButton = (Button) findViewById(R.id.toggleButton);
    mView = new SimpleView(this);
    mView.setId(0);
    mView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
    container.addView(mView);
    mSurfaceView = new SimpleSurfaceView(this);
    mSurfaceView.setId(1);
    mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
    container.addView(mSurfaceView);
    mTextureView = new SimpleTextureView(this);
    mTextureView.setId(2);
    mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
    container.addView(mTextureView);
    final TransitionSet transition = new TransitionSet();
    transition.addTransition(new ChangeBounds()).addTransition(new Crossfade().addTarget(0).addTarget(1).addTarget(2));
    toggleButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Scene newScene = new Scene(container);
            newScene.setEnterAction(new Runnable() {

                @Override
                public void run() {
                    if (mView.getWidth() <= SMALL_SIZE) {
                        mView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE));
                        mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE));
                        mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE));
                        mView.mColor = SimpleView.LARGE_COLOR;
                        mSurfaceView.mColor = SimpleSurfaceView.LARGE_COLOR;
                        mTextureView.mColor = SimpleTextureView.LARGE_COLOR;
                    } else {
                        mView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
                        mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
                        mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
                        mView.mColor = SimpleView.SMALL_COLOR;
                        mSurfaceView.mColor = SimpleSurfaceView.SMALL_COLOR;
                        mTextureView.mColor = SimpleTextureView.SMALL_COLOR;
                    }
                }
            });
            TransitionManager.go(newScene, transition);
        }
    });
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) ViewGroup(android.view.ViewGroup) ChangeBounds(android.transition.ChangeBounds) Scene(android.transition.Scene) SurfaceView(android.view.SurfaceView) TextureView(android.view.TextureView) View(android.view.View) Button(android.widget.Button) TransitionSet(android.transition.TransitionSet) Crossfade(android.transition.Crossfade)

Example 54 with TransitionSet

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

the class ScenesTestv21 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);
    transitionToResults.addTransition(fade);
    transitionToResults.addTransition(new ChangeBounds().addTarget(R.id.searchContainer));
    transitionToResults.addTransition(new Recolor().addTarget(R.id.container));
    TransitionSet transitionToSearch = new TransitionSet();
    transitionToSearch.addTransition(new Fade().addTarget(R.id.resultsText).addTarget(R.id.resultsList));
    transitionToSearch.addTransition(new ChangeBounds().addTarget(R.id.searchContainer));
    transitionToSearch.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 55 with TransitionSet

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

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