FileDocCategorySizeDatePackage
Demo4.javaAPI DocAndroid 5.1 API2903Thu Mar 12 22:22:44 GMT 2015com.android.transitiontests

Demo4

public class Demo4 extends android.app.Activity

Fields Summary
android.view.ViewGroup
mSceneRoot
static android.transition.Scene
mCurrentScene
android.transition.Scene
mSearchScreen
android.transition.Scene
mResultsScreen
android.transition.TransitionManager
mTransitionManager
Constructors Summary
Methods Summary
public voidonCreate(android.os.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);
    
public voidsendMessage(android.view.View view)

        if (mCurrentScene == mResultsScreen) {
            mTransitionManager.transitionTo(mSearchScreen);
            mCurrentScene = mSearchScreen;
        } else {
            mTransitionManager.transitionTo(mResultsScreen);
            mCurrentScene = mResultsScreen;
        }