FileDocCategorySizeDatePackage
DelayedTransition.javaAPI DocAndroid 5.1 API2789Thu Mar 12 22:22:44 GMT 2015com.android.transitiontests

DelayedTransition

public class DelayedTransition extends android.app.Activity

Fields Summary
private static final int
SEARCH_SCREEN
private static final int
RESULTS_SCREEN
android.view.ViewGroup
mSceneRoot
static int
mCurrentScene
Constructors Summary
Methods Summary
public voidonCreate(android.os.Bundle savedInstanceState)


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

        final Button button1 = (Button) findViewById(R.id.button1);
        final Button button2 = (Button) findViewById(R.id.button2);
        final LinearLayout container = (LinearLayout) findViewById(R.id.container);
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int buttonWidth = button1.getWidth();
                int containerWidth = container.getWidth();
                if (buttonWidth < containerWidth) {
                    TransitionManager.beginDelayedTransition(container, null);
                    button1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
                            LayoutParams.WRAP_CONTENT));
                    TransitionManager.beginDelayedTransition(container, null);
                    button2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                            LayoutParams.MATCH_PARENT));
                } else {
                    TransitionManager.beginDelayedTransition(container, null);
                    button1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                            LayoutParams.WRAP_CONTENT));
                    TransitionManager.beginDelayedTransition(container, null);
                    button2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                            LayoutParams.WRAP_CONTENT));
                }
            }
        });