Search in sources :

Example 36 with TransitionSet

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

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 37 with TransitionSet

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

the class ChangingText method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.changing_text_1);
    View container = findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.changing_text_1, this);
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.changing_text_2, this);
    mChanger = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER);
    mChanger.addTransition(new ChangeBounds()).addTransition(new ChangeText());
    mCurrentScene = mScene1;
}
Also used : ChangeText(android.transition.ChangeText) TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) View(android.view.View)

Example 38 with TransitionSet

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

the class CrossFadeDemo method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.crossfade);
    View container = (View) findViewById(R.id.container);
    mSceneRoot = (ViewGroup) container.getParent();
    mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.crossfade, this);
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.crossfade_1, this);
    Crossfade crossfade = new Crossfade();
    crossfade.setFadeBehavior(Crossfade.FADE_BEHAVIOR_CROSSFADE);
    crossfade.setResizeBehavior(Crossfade.RESIZE_BEHAVIOR_NONE);
    crossfade.addTarget(R.id.textview).addTarget(R.id.textview1).addTarget(R.id.textview2);
    mTransitionManager = new TransitionManager();
    TransitionSet moveCrossFade = new TransitionSet();
    moveCrossFade.addTransition(crossfade).addTransition(new ChangeBounds());
    mTransitionManager.setTransition(mScene1, moveCrossFade);
    mTransitionManager.setTransition(mScene2, moveCrossFade);
    mCurrentScene = 1;
}
Also used : TransitionManager(android.transition.TransitionManager) TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) Crossfade(android.transition.Crossfade) View(android.view.View)

Example 39 with TransitionSet

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

the class CrossfadeImage method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.crossfade_image);
    ViewGroup container = (ViewGroup) findViewById(R.id.container);
    mSceneRoot = container;
    mImageView = (ImageView) findViewById(R.id.contact_picture);
    mImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
    Crossfade mCrossfade = new Crossfade();
    mCrossfade.addTarget(R.id.contact_picture);
    TransitionSet group = new TransitionSet();
    group.setDuration(1500);
    group.addTransition(mCrossfade).addTransition(new ChangeBounds());
    mTransition = group;
}
Also used : TransitionSet(android.transition.TransitionSet) ViewGroup(android.view.ViewGroup) ChangeBounds(android.transition.ChangeBounds) Crossfade(android.transition.Crossfade)

Example 40 with TransitionSet

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

the class CrossfadeMultiple method onCreate.

@Override
public void onCreate(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());
}
Also used : ChangeText(android.transition.ChangeText) TransitionSet(android.transition.TransitionSet) ViewGroup(android.view.ViewGroup) ChangeBounds(android.transition.ChangeBounds) Crossfade(android.transition.Crossfade)

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