FileDocCategorySizeDatePackage
CrossfadeMultiple.javaAPI DocAndroid 5.1 API5686Thu Mar 12 22:22:44 GMT 2015com.android.transitiontests

CrossfadeMultiple

public class CrossfadeMultiple extends android.app.Activity

Fields Summary
android.view.ViewGroup
mSceneRoot
static int
mCurrentScene
android.transition.TransitionManager
mTransitionManager
android.transition.Transition
mTransition
android.widget.ImageView
mImageView
android.widget.TextView
mTextView
android.widget.Button
mButton
android.transition.Crossfade
mCrossfade
android.transition.TransitionSet
mCrossfadeGroup
android.transition.TransitionSet
mTextChangeGroup1
android.transition.TransitionSet
mTextChangeGroup2
android.transition.TransitionSet
mTextChangeGroup3
android.transition.TransitionSet
mInOutGroup
Constructors Summary
Methods Summary
public voidchangeTransitionType(android.view.View view)

        int id = view.getId();
        switch (id) {
            case R.id.reveal:
                mCrossfade.setFadeBehavior(Crossfade.FADE_BEHAVIOR_REVEAL);
                mTransition = mCrossfadeGroup;
                break;
            case R.id.crossfade:
                mCrossfade.setFadeBehavior(Crossfade.FADE_BEHAVIOR_CROSSFADE);
                mTransition = mCrossfadeGroup;
                break;
            case R.id.inout:
                mTransition = mInOutGroup;
                break;
            case R.id.textfade1:
                mTransition = mTextChangeGroup1;
                break;
            case R.id.textfade2:
                mTransition = mTextChangeGroup2;
                break;
            case R.id.textfade3:
                mTransition = mTextChangeGroup3;
                break;
        }
    
public voidonCreate(android.os.Bundle savedInstanceState)

        super.onCreate(savedInstanceState);
        setContentView(R.layout.crossfade_multiple);

        ViewGroup container = (ViewGroup) findViewById(R.id.container);
        mSceneRoot = container;

        mButton = (Button) findViewById(R.id.button);
        mImageView = (ImageView) findViewById(R.id.imageview);
        mTextView = (TextView) findViewById(R.id.textview);

        mCrossfade = new Crossfade();
        mCrossfade.addTarget(R.id.button).addTarget(R.id.textview).addTarget(R.id.imageview);

        mCrossfadeGroup = new TransitionSet();
        mCrossfadeGroup.setDuration(300);
        mCrossfadeGroup.addTransition(mCrossfade).addTransition(new ChangeBounds());
        mTransition = mCrossfadeGroup;

        mInOutGroup = new TransitionSet();
        Crossfade inOut = new Crossfade();
        inOut.setDuration(300);
        inOut.setFadeBehavior(Crossfade.FADE_BEHAVIOR_OUT_IN);
        ChangeBounds changeBounds = new ChangeBounds();
        changeBounds.setStartDelay(150);
        changeBounds.setDuration(0);
        mInOutGroup.addTransition(inOut).addTransition(changeBounds);

        mTextChangeGroup1 = new TransitionSet();
        ChangeText changeTextInOut = new ChangeText();
        changeTextInOut.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN);
        mTextChangeGroup1.addTransition(changeTextInOut).addTransition(new ChangeBounds());

        mTextChangeGroup2 = new TransitionSet();
        mTextChangeGroup2.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
        ChangeText changeTextOut = new ChangeText();
        changeTextOut.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT);
        mTextChangeGroup2.addTransition(changeTextOut).addTransition(new ChangeBounds());

        mTextChangeGroup3 = new TransitionSet();
        mTextChangeGroup3.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
        ChangeText changeTextIn = new ChangeText();
        changeTextIn.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_IN);
        mTextChangeGroup3.addTransition(changeTextIn).addTransition(new ChangeBounds());
    
public voidsendMessage(android.view.View view)

        TransitionManager.beginDelayedTransition(mSceneRoot, mTransition);
        int id = view.getId();
        LayoutParams params = null;
        switch (id) {
            case R.id.button1:
                params = new LayoutParams(200, 200);
                mButton.setText("A");
                mTextView.setText("1111111");
                mImageView.setImageResource(R.drawable.self_portrait_square_100);
                break;
            case R.id.button2:
                params = new LayoutParams(400, 200);
                mButton.setText("B");
                mTextView.setText("2222222");
                mImageView.setImageResource(R.drawable.self_portrait_square_200);
                break;
            case R.id.button3:
                params = new LayoutParams(200, 400);
                mButton.setText("C");
                mTextView.setText("3333333");
                mImageView.setImageResource(R.drawable.self_portrait_square_400);
                break;
        }
        mButton.setLayoutParams(params);