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
19
20<sample>
21    <name>CustomTransition</name>
22    <group>UI</group>
23    <package>com.example.android.customtransition</package>
24
25    <!-- change minSdk if needed-->
26    <minSdk>19</minSdk>
27
28
29    <strings>
30        <intro>
31            <![CDATA[
32            This sample demonstrates how to create and use a custom Transition.
33            ]]>
34        </intro>
35    </strings>
36
37    <template src="base"/>
38    <template src="FragmentView"/>
39    <common src="logger"/>
40    <common src="activities"/>
41
42    <metadata>
43        <status>PUBLISHED</status>
44        <categories>Transition, UI</categories>
45        <technologies>Android</technologies>
46        <languages>Java</languages>
47        <solutions>Mobile</solutions>
48        <level>ADVANCED</level>
49        <icon>screenshots/icon-web.png</icon>
50        <screenshots>
51            <img>screenshots/main.png</img>
52        </screenshots>
53        <api_refs>
54            <android>android.transition.TransitionManager</android>
55            <android>android.transition.Transition</android>
56            <android>android.transition.Scene</android>
57        </api_refs>
58
59        <description>
60<![CDATA[
61This sample shows how to implement a custom Transition extending the
62standard Transition class.
63]]>
64        </description>
65
66        <intro>
67<![CDATA[
68In order to create a custom Transition, you first need to override
69[captureStartValues][1] and [captureEndValues][2]. In those method, you have to
70extract all the relevant properties from a View. These methods are called for
71each of the Views in the hierarchy.
72
73Then, you need to override [createAnimator][3] and create an Animator based on
74the property values you extracted. This method will also be called for each of
75the Views in the hierarchy. If you want to skip some Views, simply return null.
76
77The instantiated custom Transition can be applied by passing it as the second
78parameter of [TransitionManager.go][4].
79
80```java
81TransitionManager.go(mScenes[mCurrentScene], mTransition);
82```
83
84[1]: https://developer.android.com/reference/android/transition/Transition.html#captureStartValues(android.transition.TransitionValues)
85[2]: https://developer.android.com/reference/android/transition/Transition.html#captureEndValues(android.transition.TransitionValues)
86[3]: https://developer.android.com/reference/android/transition/Transition.html#createAnimator(android.view.ViewGroup, android.transition.TransitionValues, android.transition.TransitionValues)
87[4]: https://developer.android.com/reference/android/transition/TransitionManager.html#go(android.transition.Scene, android.transition.Transition)
88]]>
89        </intro>
90    </metadata>
91
92</sample>
93