Example usage for android.transition TransitionManager go

List of usage examples for android.transition TransitionManager go

Introduction

In this page you can find the example usage for android.transition TransitionManager go.

Prototype

public static void go(Scene scene) 

Source Link

Document

Convenience method to simply change to the given scene using the default transition for TransitionManager.

Usage

From source file:MainActivity.java

public void goAnimate(View view) {

    ViewGroup root = (ViewGroup) findViewById(R.id.layout);
    Scene scene = new Scene(root);

    Transition transition = new ChangeBounds();
    TransitionManager.beginDelayedTransition(root, transition);

    TextView textViewTop = (TextView) findViewById(R.id.textViewTop);
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) textViewTop.getLayoutParams();
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 1);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0);
    textViewTop.setLayoutParams(params);

    TextView textViewBottom = (TextView) findViewById(R.id.textViewBottom);
    params = (RelativeLayout.LayoutParams) textViewBottom.getLayoutParams();
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP, 1);
    textViewBottom.setLayoutParams(params);

    TransitionManager.go(scene);

}

From source file:com.example.android.customtransition.CustomTransitionFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    Context context = getActivity();
    FrameLayout container = (FrameLayout) view.findViewById(R.id.container);
    view.findViewById(R.id.show_next_scene).setOnClickListener(this);
    if (null != savedInstanceState) {
        mCurrentScene = savedInstanceState.getInt(STATE_CURRENT_SCENE);
    }/*  w w w  . j  a  va 2s.  co m*/
    // We set up the Scenes here.
    mScenes = new Scene[] { Scene.getSceneForLayout(container, R.layout.scene1, context),
            Scene.getSceneForLayout(container, R.layout.scene2, context),
            Scene.getSceneForLayout(container, R.layout.scene3, context), };
    // This is the custom Transition.
    mTransition = new ChangeColor();
    // Show the initial Scene.
    TransitionManager.go(mScenes[mCurrentScene % mScenes.length]);
}

From source file:info.ipeanut.googletrainingcoursedemos.customtransition.CustomTransitionFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    Context context = getActivity();
    FrameLayout container = (FrameLayout) view.findViewById(R.id.container);
    view.findViewById(R.id.show_next_scene).setOnClickListener(this);
    if (null != savedInstanceState) {
        mCurrentScene = savedInstanceState.getInt(STATE_CURRENT_SCENE);
    }//from   w  w w .j a  v a2s. co  m
    // We set up the Scenes here.
    mScenes = new Scene[] { Scene.getSceneForLayout(container, R.layout.scene_c1, context),
            Scene.getSceneForLayout(container, R.layout.scene_c2, context),
            Scene.getSceneForLayout(container, R.layout.scene_c3, context), };
    // This is the custom Transition.
    mTransition = new ChangeColor();
    // Show the initial Scene.
    TransitionManager.go(mScenes[mCurrentScene % mScenes.length]);
}

From source file:info.ipeanut.googletrainingcoursedemos.basictransition.BasicTransitionFragment.java

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    switch (checkedId) {
    case R.id.select_scene_1: {

        // You can start an automatic transition with TransitionManager.go().
        TransitionManager.go(mScene1);

        break;/*from  w ww  .  ja  va  2s.  c om*/
    }
    case R.id.select_scene_2: {
        TransitionManager.go(mScene2);
        break;
    }
    case R.id.select_scene_3: {

        // You can also start a transition with a custom TransitionManager.
        mTransitionManagerForScene3.transitionTo(mScene3);

        break;
    }
    case R.id.select_scene_4: {

        // Alternatively, transition can be invoked dynamically without a Scene.
        // For this, we first call TransitionManager.beginDelayedTransition().
        TransitionManager.beginDelayedTransition(mSceneRoot);
        // Then, we can just change view properties as usual.
        View square = mSceneRoot.findViewById(R.id.transition_square);
        ViewGroup.LayoutParams params = square.getLayoutParams();
        int newSize = getResources().getDimensionPixelSize(R.dimen.square_size_expanded);
        params.width = newSize;
        params.height = newSize;
        square.setLayoutParams(params);

        break;
    }
    }
}

From source file:com.example.android.basictransition.BasicTransitionFragment.java

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    switch (checkedId) {
    case R.id.select_scene_1: {
        // BEGIN_INCLUDE(transition_simple)
        // You can start an automatic transition with TransitionManager.go().
        TransitionManager.go(mScene1);
        // END_INCLUDE(transition_simple)
        break;//from  www.j a va 2 s.  c  om
    }
    case R.id.select_scene_2: {
        TransitionManager.go(mScene2);
        break;
    }
    case R.id.select_scene_3: {
        // BEGIN_INCLUDE(transition_custom)
        // You can also start a transition with a custom TransitionManager.
        mTransitionManagerForScene3.transitionTo(mScene3);
        // END_INCLUDE(transition_custom)
        break;
    }
    case R.id.select_scene_4: {
        // BEGIN_INCLUDE(transition_dynamic)
        // Alternatively, transition can be invoked dynamically without a Scene.
        // For this, we first call TransitionManager.beginDelayedTransition().
        TransitionManager.beginDelayedTransition(mSceneRoot);
        // Then, we can just change view properties as usual.
        View square = mSceneRoot.findViewById(R.id.transition_square);
        ViewGroup.LayoutParams params = square.getLayoutParams();
        int newSize = getResources().getDimensionPixelSize(R.dimen.square_size_expanded);
        params.width = newSize;
        params.height = newSize;
        square.setLayoutParams(params);
        // END_INCLUDE(transition_dynamic)
        break;
    }
    }
}

From source file:com.example.android.fragmenttransition.DetailFragment.java

@Override
public void onAnimationEnd(Animation animation) {
    // This method is called at the end of the animation for the fragment transaction,
    // which is perfect time to start our Transition.
    Log.i(TAG, "Fragment animation ended. Starting a Transition.");
    final Scene scene = Scene.getSceneForLayout((ViewGroup) getView(), R.layout.fragment_detail_content,
            getActivity());/*w w w  .j  a  v  a  2s .  co  m*/
    TransitionManager.go(scene);
    // Note that we need to bind views with data after we call TransitionManager.go().
    bind(scene.getSceneRoot());
}

From source file:com.intel.demo.fragmenttransition.DetailFragment.java

@TargetApi(Build.VERSION_CODES.KITKAT)
@Override// w  w  w  . j a v a2s. c o m
public void onAnimationEnd(Animation animation) {
    // This method is called at the end of the animation for the fragment transaction,
    // which is perfect time to start our Transition.
    Log.i(TAG, "Fragment animation ended. Starting a Transition.");
    final Scene scene = Scene.getSceneForLayout((ViewGroup) getView(), R.layout.fragment_detail_content,
            getActivity());
    TransitionManager.go(scene);
    // Note that we need to bind views with data after we call TransitionManager.go().
    bind(scene.getSceneRoot());
}

From source file:tabhostapp.com.tabhostapp.DetailFragment.java

@Override
public void onAnimationEnd(Animation animation) {
    // This method is called at the end of the animation for the fragment transaction,
    // which is perfect time to start our Transition.
    final Scene scene = Scene.getSceneForLayout((ViewGroup) getView(), R.layout.fragment_detail_content,
            getActivity());/*w ww . j av  a 2 s  . c o m*/
    TransitionManager.go(scene);
    // Note that we need to bind views with data after we call TransitionManager.go().
    bind(scene.getSceneRoot());
}

From source file:com.dev.foundingfourfathers.alchemy.BrowseCocktails.DetailFragment.java

@Override
public void onAnimationEnd(Animation animation) {
    // This method is called at the end of the animation for the fragment transaction,
    // which is perfect time to start our Transition.
    //Log.i(TAG, "Fragment animation ended. Starting a Transition.");

    final Scene scene = Scene.getSceneForLayout((ViewGroup) getView(), R.layout.fragment_detail_content,
            getActivity());//w  w  w. j a  va  2 s  .  c om
    TransitionManager.go(scene);
    // Note that we need to bind views with data after we call TransitionManager.go().
    bind(scene.getSceneRoot());
    setText(DRINK);
}