Example usage for android.transition Scene Scene

List of usage examples for android.transition Scene Scene

Introduction

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

Prototype

@Deprecated
public Scene(ViewGroup sceneRoot, ViewGroup layout) 

Source Link

Usage

From source file:Main.java

@TargetApi(Build.VERSION_CODES.KITKAT)
public static void createChangeBoundsAnimation(View disappearingView, View appearingView) {
    Scene scene;/*from ww  w .  j  a  v  a  2  s.c  o  m*/
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        scene = new Scene((ViewGroup) disappearingView.getParent(), appearingView);
    } else {
        scene = new Scene((ViewGroup) disappearingView.getParent(), (ViewGroup) appearingView.getParent());
    }

    TransitionManager.beginDelayedTransition((ViewGroup) disappearingView.getParent(), new ChangeBounds());
    disappearingView.setLeft(appearingView.getLeft());
}

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

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_basic_transition, container, false);
    assert view != null;
    RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.select_scene);
    radioGroup.setOnCheckedChangeListener(this);
    mSceneRoot = (ViewGroup) view.findViewById(R.id.scene_root);

    // BEGIN_INCLUDE(instantiation_from_view)
    // A Scene can be instantiated from a live view hierarchy.
    mScene1 = new Scene(mSceneRoot, (ViewGroup) mSceneRoot.findViewById(R.id.container));
    // END_INCLUDE(instantiation_from_view)

    // BEGIN_INCLUDE(instantiation_from_resource)
    // You can also inflate a generate a Scene from a layout resource file.
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene2, getActivity());
    // END_INCLUDE(instantiation_from_resource)

    // Another scene from a layout resource file.
    mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene3, getActivity());

    // BEGIN_INCLUDE(custom_transition_manager)
    // We create a custom TransitionManager for Scene 3, in which ChangeBounds and Fade
    // take place at the same time.
    mTransitionManagerForScene3 = TransitionInflater.from(getActivity())
            .inflateTransitionManager(R.transition.scene3_transition_manager, mSceneRoot);
    // END_INCLUDE(custom_transition_manager)

    return view;/*from   w  w  w  . j a va2  s  .c o  m*/
}

From source file:com.example.st.animsharedemo.transitions.BasicTransitionFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_basic_transition, container, false);
    assert view != null;
    RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.select_scene);
    radioGroup.setOnCheckedChangeListener(this);
    mSceneRoot = (ViewGroup) view.findViewById(R.id.scene_root);

    // BEGIN_INCLUDE(instantiation_from_view)
    // A Scene can be instantiated from a live view hierarchy.
    mScene1 = new Scene(mSceneRoot, (ViewGroup) mSceneRoot.findViewById(R.id.container));
    // END_INCLUDE(instantiation_from_view)

    // BEGIN_INCLUDE(instantiation_from_resource)
    // You can also inflate a generate a Scene from a layout resource file.
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene22, getActivity());
    // END_INCLUDE(instantiation_from_resource)

    // Another scene from a layout resource file.
    mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene33, getActivity());

    // BEGIN_INCLUDE(custom_transition_manager)
    // We create a custom TransitionManager for Scene 3, in which ChangeBounds and Fade
    // take place at the same time.
    mTransitionManagerForScene3 = TransitionInflater.from(getActivity())
            .inflateTransitionManager(R.transition.scene3_transition_manager, mSceneRoot);
    // END_INCLUDE(custom_transition_manager)

    return view;// w  ww  .jav  a 2s  . c  o  m
}

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

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_basic_transition, container, false);
    assert view != null;
    RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.select_scene);
    radioGroup.setOnCheckedChangeListener(this);
    mSceneRoot = (ViewGroup) view.findViewById(R.id.scene_root);

    // A Scene can be instantiated from a live view hierarchy.
    mScene1 = new Scene(mSceneRoot, (ViewGroup) mSceneRoot.findViewById(R.id.container));

    // You can also inflate a generate a Scene from a layout resource file.
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene_b2, getActivity());

    // Another scene from a layout resource file.
    mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene_b3, getActivity());

    // We create a custom TransitionManager for Scene 3, in which ChangeBounds and Fade
    // take place at the same time.
    mTransitionManagerForScene3 = TransitionInflater.from(getActivity())
            .inflateTransitionManager(R.transition.scene3_transition_manager, mSceneRoot);

    return view;//  w  w w.j  a v  a 2s .c  o m
}

From source file:com.kai.uGuide.ui.fragment.AdapterTransitionFragment.java

/**
 * Toggle the UI between ListView and GridView.
 *//*from   w  ww  . ja va  2  s  .  c om*/
public void toggle() {
    // We use mCover as the overlay on which we carry out the transition.
    mCover.setVisibility(View.VISIBLE);
    // This FrameLayout holds all the visible views in the current list or grid. We use this as
    // the starting Scene of the Transition later.
    FrameLayout before = copyVisibleViews();
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.MATCH_PARENT);
    mCover.addView(before, params);
    // Swap the actual list.
    swapAbsListView();
    // We also swap the icon for the toggle button.
    ActivityCompat.invalidateOptionsMenu(getActivity());
    // It is now ready to start the transition.
    mAbsListView.post(new Runnable() {
        @Override
        public void run() {
            // BEGIN_INCLUDE(transition_with_listener)
            Scene scene = new Scene(mCover, copyVisibleViews());
            Transition transition = new AutoTransition();
            transition.addListener(AdapterTransitionFragment.this);
            TransitionManager.go(scene, transition);
            // END_INCLUDE(transition_with_listener)
        }
    });
}

From source file:com.example.kent_zheng.sdk_adaptertransition.AdapterTransitionFragment.java

/**
 * Toggle the UI between ListView and GridView.
 *//*ww  w  .  j a  v  a2 s .c  o  m*/
private void toggle() {
    // We use mCover as the overlay on which we carry out the transition.
    mCover.setVisibility(View.VISIBLE);
    // This FrameLayout holds all the visible views in the current list or grid. We use this as
    // the starting Scene of the Transition later.
    FrameLayout before = copyVisibleViews();
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.MATCH_PARENT);
    mCover.addView(before, params);
    // Swap the actual list.
    swapAbsListView();

    // We also swap the icon for the toggle button.
    ActivityCompat.invalidateOptionsMenu(getActivity());
    // It is now ready to start the transition.
    mAbsListView.post(new Runnable() {
        @Override
        public void run() {

            Scene scene = new Scene(mCover, copyVisibleViews());
            Transition transition = new AutoTransition();
            transition.addListener(AdapterTransitionFragment.this);
            TransitionManager.go(scene, transition);

        }
    });
}

From source file:com.example.android.adaptertransition.AdapterTransitionFragment.java

/**
 * Toggle the UI between ListView and GridView.
 *///from w w  w .  j  av a  2 s .c  o m
private void toggle() {
    // We use mCover as the overlay on which we carry out the transition.
    mCover.setVisibility(View.VISIBLE);
    // This FrameLayout holds all the visible views in the current list or grid. We use this as
    // the starting Scene of the Transition later.
    FrameLayout before = copyVisibleViews();
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.MATCH_PARENT);
    mCover.addView(before, params);
    // Swap the actual list.
    swapAbsListView();
    // We also swap the icon for the toggle button.
    ActivityCompat.invalidateOptionsMenu(getActivity());
    // It is now ready to start the transition.
    mAbsListView.post(new Runnable() {
        @Override
        public void run() {
            // BEGIN_INCLUDE(transition_with_listener)
            Scene scene = new Scene(mCover, copyVisibleViews());
            Transition transition = new AutoTransition();
            transition.addListener(AdapterTransitionFragment.this);
            TransitionManager.go(scene, transition);
            // END_INCLUDE(transition_with_listener)
        }
    });
}

From source file:com.saulmm.cui.OrderDialogFragment.java

private void changeToConfirmScene() {
    final LayoutOrderConfirmationBinding confBinding = prepareConfirmationBinding();

    final Scene scene = new Scene(binding.content, ((ViewGroup) confBinding.getRoot()));

    scene.setEnterAction(onEnterConfirmScene(confBinding));

    final Transition transition = TransitionInflater.from(getContext())
            .inflateTransition(R.transition.transition_confirmation_view);

    TransitionManager.go(scene, transition);
}