1<?xml version="1.0" encoding="UTF-8"?> 2<!-- 3 Copyright 2013 The Android Open Source Project 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16--> 17 18<sample> 19 <name>FragmentTransition</name> 20 <group>UI</group> 21 <package>com.example.android.fragmenttransition</package> 22 23 <minSdk>19</minSdk> 24 25 <strings> 26 <intro> 27 <![CDATA[ 28 This sample demonstrates how to start a transition right after a fragment transaction. 29 ]]> 30 </intro> 31 </strings> 32 33 <template src="base"/> 34 <template src="FragmentView"/> 35 <common src="logger"/> 36 <common src="activities"/> 37 <common src="view"/> 38 39 <metadata> 40 <status>PUBLISHED</status> 41 <categories>Transition, UI</categories> 42 <technologies>Android</technologies> 43 <languages>Java</languages> 44 <solutions>Mobile</solutions> 45 <level>ADVANCED</level> 46 <icon>screenshots/icon-web.png</icon> 47 <screenshots> 48 <img>screenshots/grid.png</img> 49 <img>screenshots/main.png</img> 50 </screenshots> 51 <api_refs> 52 <android>android.transition.TransitionManager</android> 53 <android>android.transition.Transition</android> 54 <android>android.transition.Scene</android> 55 </api_refs> 56 57 <description> 58<![CDATA[ 59This sample demonstrates how to start a Transition after a Fragment Transaction. 60]]> 61 </description> 62 63 <intro> 64<![CDATA[ 65This sample uses [the Transition framework][1] to show a nice visual effect on 66Fragment Transaction. 67 68Animation for fragment _transaction_ can be customized by overriding 69[onCreateAnimation][2]. In this sample, we set up an AnimationListener 70for this Animation, and start our Transition on [onAnimationEnd][3]. 71 72Transition is started by calling [TransitionManager.go][4]. We don't 73instantiate a Scene for the initial state of Transition, as we never 74go back. One thing we need to be careful here is that we need to 75populate the content of Views after starting the Transition. 76 77[1]: https://developer.android.com/reference/android/transition/package-summary.html 78[2]: http://developer.android.com/reference/android/support/v4/app/Fragment.html#onCreateAnimation(int, boolean, int) 79[3]: http://developer.android.com/reference/android/view/animation/Animation.AnimationListener.html#onAnimationEnd(android.view.animation.Animation) 80[4]: http://developer.android.com/reference/android/transition/TransitionManager.html#go(android.transition.Scene) 81]]> 82 </intro> 83 </metadata> 84 85</sample> 86