Search in sources :

Example 1 with Scene

use of android.transition.Scene in project platform_frameworks_base by android.

the class PhoneWindow method setContentView.

@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
    // before this happens.
    if (mContentParent == null) {
        installDecor();
    } else if (!hasFeature(FEATURE_CONTENT_TRANSITIONS)) {
        mContentParent.removeAllViews();
    }
    if (hasFeature(FEATURE_CONTENT_TRANSITIONS)) {
        view.setLayoutParams(params);
        final Scene newScene = new Scene(mContentParent, view);
        transitionTo(newScene);
    } else {
        mContentParent.addView(view, params);
    }
    mContentParent.requestApplyInsets();
    final Callback cb = getCallback();
    if (cb != null && !isDestroyed()) {
        cb.onContentChanged();
    }
    mContentParentExplicitlySet = true;
}
Also used : Scene(android.transition.Scene)

Example 2 with Scene

use of android.transition.Scene in project platform_frameworks_base by android.

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 3 with Scene

use of android.transition.Scene in project platform_frameworks_base by android.

the class Demo1 method onCreate.

@Override
public void onCreate(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);
        }
    });
}
Also used : LayoutInflater(android.view.LayoutInflater) Scene(android.transition.Scene) View(android.view.View)

Example 4 with Scene

use of android.transition.Scene in project platform_frameworks_base by android.

the class PhoneWindow method setContentView.

@Override
public void setContentView(int layoutResID) {
    // before this happens.
    if (mContentParent == null) {
        installDecor();
    } else if (!hasFeature(FEATURE_CONTENT_TRANSITIONS)) {
        mContentParent.removeAllViews();
    }
    if (hasFeature(FEATURE_CONTENT_TRANSITIONS)) {
        final Scene newScene = Scene.getSceneForLayout(mContentParent, layoutResID, getContext());
        transitionTo(newScene);
    } else {
        mLayoutInflater.inflate(layoutResID, mContentParent);
    }
    mContentParent.requestApplyInsets();
    final Callback cb = getCallback();
    if (cb != null && !isDestroyed()) {
        cb.onContentChanged();
    }
    mContentParentExplicitlySet = true;
}
Also used : Scene(android.transition.Scene)

Example 5 with Scene

use of android.transition.Scene 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)

Aggregations

Scene (android.transition.Scene)26 View (android.view.View)12 ChangeBounds (android.transition.ChangeBounds)8 Transition (android.transition.Transition)8 TransitionSet (android.transition.TransitionSet)8 AutoTransition (android.transition.AutoTransition)4 Crossfade (android.transition.Crossfade)4 Fade (android.transition.Fade)4 TransitionInflater (android.transition.TransitionInflater)4 LayoutInflater (android.view.LayoutInflater)4 SurfaceView (android.view.SurfaceView)4 TextureView (android.view.TextureView)4 ViewGroup (android.view.ViewGroup)4 ViewTreeObserver (android.view.ViewTreeObserver)4 AdapterView (android.widget.AdapterView)4 Button (android.widget.Button)4 LinearLayout (android.widget.LinearLayout)4 LayoutParams (android.widget.LinearLayout.LayoutParams)4 ListView (android.widget.ListView)4 TextView (android.widget.TextView)4