|
3 | 3 | xmlns:android="http://schemas.android.com/apk/res/android"> |
4 | 4 |
|
5 | 5 | <Transition |
6 | | - app:constraintSetEnd="@+id/end" |
7 | | - app:constraintSetStart="@id/start" |
| 6 | + app:constraintSetEnd="@+id/collapsed" |
| 7 | + app:constraintSetStart="@id/expanded" |
8 | 8 | > |
9 | 9 | <KeyFrameSet > |
| 10 | + <!-- Hold title in place --> |
10 | 11 | <KeyPosition |
11 | 12 | app:motionTarget="@+id/title" |
12 | 13 | app:framePosition="25" |
13 | 14 | app:percentX="0.0" |
14 | 15 | app:percentY=".2" /> |
| 16 | + <!-- At 55, title should still be in place --> |
15 | 17 | <KeyPosition |
16 | 18 | app:motionTarget="@+id/title" |
17 | 19 | app:framePosition="55" |
18 | 20 | app:percentX="0" /> |
| 21 | + <!-- at 75, title is 50% to destination --> |
19 | 22 | <KeyPosition |
20 | 23 | app:motionTarget="@+id/title" |
21 | 24 | app:framePosition="75" |
22 | 25 | app:percentX=".5" /> |
| 26 | + <!-- Hide subtitle until 55 --> |
23 | 27 | <KeyAttribute |
24 | 28 | app:motionTarget="@+id/subtitle" |
25 | 29 | app:framePosition="55" |
26 | 30 | android:alpha="0" /> |
| 31 | + <!-- Hold subtitle in place until 55 --> |
27 | 32 | <KeyPosition |
28 | 33 | app:motionTarget="@+id/subtitle" |
29 | 34 | app:framePosition="55" |
30 | 35 | app:percentX="0" /> |
| 36 | + <!-- at 55, subtitle is 50% to destination --> |
31 | 37 | <KeyPosition |
32 | 38 | app:motionTarget="@+id/subtitle" |
33 | 39 | app:framePosition="75" |
34 | 40 | app:percentX=".5" /> |
| 41 | + <!-- "pop" icon out at 35, with some translation to make it visually stay in place --> |
35 | 42 | <KeyAttribute |
36 | 43 | app:motionTarget="@+id/icon" |
37 | 44 | app:framePosition="35" |
|
40 | 47 | android:translationY="30dp" |
41 | 48 | android:translationX="0dp" |
42 | 49 | app:curveFit="linear" /> |
| 50 | + <!-- Don't move icon along curve until 35 --> |
43 | 51 | <KeyPosition |
44 | 52 | app:motionTarget="@+id/icon" |
45 | 53 | app:framePosition="35" |
46 | 54 | app:percentX="0" |
47 | 55 | app:percentY="0" |
48 | 56 | app:curveFit="linear" /> |
| 57 | + <!-- Between 35 and 36 while icon is not visible, jump icon to it's final location --> |
49 | 58 | <KeyPosition |
50 | 59 | app:motionTarget="@+id/icon" |
51 | 60 | app:framePosition="36" |
52 | 61 | app:percentX="1" |
53 | 62 | app:percentY="1" |
54 | 63 | app:curveFit="linear" /> |
| 64 | + <!-- Translate icon a bit to make it "fill in" after jump --> |
55 | 65 | <KeyAttribute |
56 | 66 | app:motionTarget="@+id/icon" |
57 | 67 | app:framePosition="36" |
58 | 68 | android:translationY="-30dp" |
59 | 69 | android:translationX="20dp" |
60 | 70 | app:curveFit="linear" /> |
| 71 | + <!-- Animate the bottomCutSize to 0 --> |
61 | 72 | <KeyAttribute |
62 | 73 | app:motionTarget="@id/background" |
63 | 74 | app:framePosition="60"> |
64 | 75 | <CustomAttribute app:attributeName="bottomCutSize" app:customDimension="0dp" /> |
65 | 76 | </KeyAttribute> |
| 77 | + <!-- animate the endCutSize to 200, a little before the end of animation --> |
66 | 78 | <KeyAttribute |
67 | 79 | app:motionTarget="@id/background" |
68 | 80 | app:framePosition="80"> |
69 | 81 | <CustomAttribute app:attributeName="endCutSize" app:customDimension="200dp" /> |
70 | 82 | </KeyAttribute> |
| 83 | + <!-- bring the system bar overlay in slightly early (numbers decided visually) --> |
71 | 84 | <KeyPosition |
72 | 85 | app:motionTarget="@+id/systembar_overlay" |
73 | 86 | app:framePosition="45" |
|
76 | 89 | </KeyFrameSet> |
77 | 90 | </Transition> |
78 | 91 |
|
79 | | - <ConstraintSet android:id="@+id/start"> |
| 92 | + <!-- Start constraint set uses expanded_bottom and parent as bottom and top bounds --> |
| 93 | + <ConstraintSet android:id="@+id/expanded"> |
80 | 94 | <Constraint |
81 | 95 | android:id="@+id/title" |
82 | 96 | android:layout_width="wrap_content" |
|
128 | 142 | app:layout_constraintEnd_toEndOf="parent" /> |
129 | 143 | </ConstraintSet> |
130 | 144 |
|
131 | | - <ConstraintSet android:id="@+id/end" > |
| 145 | + <!-- end constraint set uses collapsed_top and parent as top and bottom, with inset as |
| 146 | + guideline --> |
| 147 | + <ConstraintSet android:id="@+id/collapsed" > |
132 | 148 | <Constraint |
133 | 149 | android:id="@+id/title" |
134 | 150 | android:layout_height="wrap_content" |
|
0 commit comments