blob: 323ee3650ac091ceac72adf38ef9ac8f25258a73 [file] [log] [blame] [view]
Trevor Johnse904b622014-08-27 18:30:35 -07001
Trevor Johns89d2da02015-08-13 18:28:15 -07002Android CustomTransition Sample
3===================================
4
5This sample shows how to implement a custom Transition extending the
6standard Transition class.
7
8Introduction
9------------
10
11In order to create a custom Transition, you first need to override
12[captureStartValues][1] and [captureEndValues][2]. In those method, you have to
13extract all the relevant properties from a View. These methods are called for
14each of the Views in the hierarchy.
15
16Then, you need to override [createAnimator][3] and create an Animator based on
17the property values you extracted. This method will also be called for each of
18the Views in the hierarchy. If you want to skip some Views, simply return null.
19
20The instantiated custom Transition can be applied by passing it as the second
21parameter of [TransitionManager.go][4].
22
23```java
24TransitionManager.go(mScenes[mCurrentScene], mTransition);
25```
26
27[1]: https://developer.android.com/reference/android/transition/Transition.html#captureStartValues(android.transition.TransitionValues)
28[2]: https://developer.android.com/reference/android/transition/Transition.html#captureEndValues(android.transition.TransitionValues)
29[3]: https://developer.android.com/reference/android/transition/Transition.html#createAnimator(android.view.ViewGroup, android.transition.TransitionValues, android.transition.TransitionValues)
30[4]: https://developer.android.com/reference/android/transition/TransitionManager.html#go(android.transition.Scene, android.transition.Transition)
Trevor Johnse904b622014-08-27 18:30:35 -070031
32Pre-requisites
33--------------
34
Trevor Johnsfc1c2ea2016-08-11 15:43:37 -070035- Android SDK 24
36- Android Build Tools v24.0.1
Trevor Johnse904b622014-08-27 18:30:35 -070037- Android Support Repository
38
Trevor Johns89d2da02015-08-13 18:28:15 -070039Screenshots
40-------------
41
42<img src="screenshots/main.png" height="400" alt="Screenshot"/>
43
Trevor Johnse904b622014-08-27 18:30:35 -070044Getting Started
45---------------
46
47This sample uses the Gradle build system. To build this project, use the
48"gradlew build" command or use "Import Project" in Android Studio.
49
50Support
51-------
52
53- Google+ Community: https://plus.google.com/communities/105153134372062985968
54- Stack Overflow: http://stackoverflow.com/questions/tagged/android
55
56If you've found an error in this sample, please file an issue:
57https://github.com/googlesamples/android-CustomTransition
58
59Patches are encouraged, and may be submitted by forking this project and
60submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
61
62License
63-------
64
Trevor Johnsfc1c2ea2016-08-11 15:43:37 -070065Copyright 2016 The Android Open Source Project, Inc.
Trevor Johnse904b622014-08-27 18:30:35 -070066
67Licensed to the Apache Software Foundation (ASF) under one or more contributor
68license agreements. See the NOTICE file distributed with this work for
69additional information regarding copyright ownership. The ASF licenses this
70file to you under the Apache License, Version 2.0 (the "License"); you may not
71use this file except in compliance with the License. You may obtain a copy of
72the License at
73
Trevor Johns89d2da02015-08-13 18:28:15 -070074http://www.apache.org/licenses/LICENSE-2.0
Trevor Johnse904b622014-08-27 18:30:35 -070075
76Unless required by applicable law or agreed to in writing, software
77distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
78WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
79License for the specific language governing permissions and limitations under
80the License.