/** * Inflates a new transition manager from the specified Xml <var>resource</var>. * * @param resource Resource id of the desired transition manager to be inflated. * @param sceneRoot Scene root with which to create the requested manager. * @return Inflated transition manager or {@code null} if the current Android version does not * support inflating of transitions from the Xml. */ @Nullable @SuppressLint("NewApi") protected TransitionManager inflateTransitionManager(int resource, @NonNull ViewGroup sceneRoot) { if (!FragmentsConfig.TRANSITIONS_SUPPORTED) return null; this.ensureTransitionInflater(); return mTransitionInflater.inflateTransitionManager(resource, sceneRoot); }
/** * Inflates a new transition manager from the specified Xml <var>resource</var>. * * @param resource Resource id of the desired transition manager to be inflated. * @param sceneRoot Scene root with which to create the requested manager. * @return Inflated transition manager or {@code null} if the current Android version does not * support inflating of transitions from the Xml. */ @Nullable @SuppressLint("NewApi") protected TransitionManager inflateTransitionManager(int resource, @NonNull ViewGroup sceneRoot) { if (!FragmentsConfig.TRANSITIONS_SUPPORTED) return null; this.ensureTransitionInflater(); return mTransitionInflater.inflateTransitionManager(resource, sceneRoot); }
/** * Inflates a new instance of TransitionManager from the specified <var>resource</var>. * <p> * <b>Note</b>, that for pre {@link Build.VERSION_CODES#LOLLIPOP LOLLIPOP} Android * versions this method does nothing and returns {@code null}. * * @param resource Resource id of the desired transition manager to inflater. * @param sceneRoot Root view for the scene with which will the manager operate. * @return Inflated transition manager. */ @Nullable @SuppressLint("NewApi") public TransitionManager inflateTransitionManager(int resource, @NonNull ViewGroup sceneRoot) { if (!UiConfig.MATERIALIZED) return null; this.ensureTransitionInflater(sceneRoot.getContext()); return mTransitionInflater.inflateTransitionManager(resource, sceneRoot); }
/** * Inflates a new instance of TransitionManager from the specified <var>resource</var>. * <p> * <b>Note</b>, that for pre {@link Build.VERSION_CODES#LOLLIPOP LOLLIPOP} Android * versions this method does nothing and returns {@code null}. * * @param resource Resource id of the desired transition manager to inflater. * @param sceneRoot Root view for the scene with which will the manager operate. * @return Inflated transition manager. */ @Nullable @SuppressLint("NewApi") public TransitionManager inflateTransitionManager(int resource, @NonNull ViewGroup sceneRoot) { if (!UiConfig.MATERIALIZED) return null; this.ensureTransitionInflater(sceneRoot.getContext()); return mTransitionInflater.inflateTransitionManager(resource, sceneRoot); }
@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; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.transition); mSceneRoot = (ViewGroup) findViewById(R.id.sceneRoot); TransitionInflater inflater = TransitionInflater.from(this); // Note that this is not the only way to create a Scene object, but that // loading them from layout resources cooperates with the // TransitionManager that we are also loading from resources, and which // uses the same layout resource files to determine the scenes to transition // from/to. mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene1, this); mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene2, this); mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene3, this); mTransitionManager = inflater.inflateTransitionManager(R.transition.transitions_mgr, mSceneRoot); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.transition); mSceneRoot = (ViewGroup) findViewById(R.id.sceneRoot); TransitionInflater inflater = TransitionInflater.from(this); // Note that this is not the only way to create a Scene object, but that // loading them from layout resources cooperates with the // TransitionManager that we are also loading from resources, and which // uses the same layout resource files to determine the scenes to transition // from/to. mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene1, this); mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene2, this); mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene3, this); mTransitionManager = inflater.inflateTransitionManager(R.transition.transitions_mgr, mSceneRoot); }