FileDocCategorySizeDatePackage
Demo1.javaAPI DocAndroid 5.1 API3340Thu Mar 12 22:22:44 GMT 2015com.android.transitiontests

Demo1

public class Demo1 extends android.app.Activity

Fields Summary
android.view.ViewGroup
mSceneRoot
static android.transition.Scene
mCurrentScene
boolean
mFirstTime
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();

//        mResultsScreen = new MyScene(mSceneRoot, R.layout.results_screen);
//        mSearchScreen = new MyScene(mSceneRoot, R.layout.search_screen);
        mResultsScreen = new Scene(mSceneRoot);
        mResultsScreen.setEnterAction(new Runnable() {
            @Override
            public void run() {
                LayoutInflater inflater = (LayoutInflater)
                        getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                inflater.inflate(R.layout.results_screen, mSceneRoot);
            }
        });
        mSearchScreen = new Scene(mSceneRoot);
        mSearchScreen.setEnterAction(new Runnable() {
            @Override
            public void run() {
                LayoutInflater inflater = (LayoutInflater)
                        getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                inflater.inflate(R.layout.search_screen, mSceneRoot);
            }
        });

    
public voidsendMessage(android.view.View view)

        if (mFirstTime) {
            mFirstTime = false;
            TransitionSet transition = new TransitionSet();
            transition.addTransition(new Fade().addTarget(R.id.resultsText).
                    addTarget(R.id.resultsList)).
                    addTransition(new ChangeBounds().addTarget(R.id.searchContainer));
            mTransitionManager = new TransitionManager();
            mTransitionManager.setTransition(mSearchScreen, transition);
            mTransitionManager.setTransition(mResultsScreen, transition);
        }
        if (mCurrentScene == mResultsScreen) {
            mTransitionManager.transitionTo(mSearchScreen);
            mCurrentScene = mSearchScreen;
        } else {
            mTransitionManager.transitionTo(mResultsScreen);
            mCurrentScene = mResultsScreen;
        }