-
-
Notifications
You must be signed in to change notification settings - Fork 875
/
scene_show_details.xml
229 lines (193 loc) · 9.21 KB
/
scene_show_details.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2018 Google, Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Transition
app:constraintSetEnd="@id/end"
app:constraintSetStart="@id/start"
app:duration="200">
<OnSwipe
app:dragDirection="dragUp"
app:moveWhenScrollAtTop="true"
app:touchAnchorId="@id/details_rv"
app:touchAnchorSide="top" />
<KeyFrameSet>
<!-- See https://issuetracker.google.com/issues/112546214 for why we're using percentX
instead of percentY -->
<KeyPosition
app:framePosition="20"
app:keyPositionType="pathRelative"
app:percentX="0.62"
app:target="@id/details_poster" />
<!-- This looks weird. We need a quick change from elevated to not-so-elevated at 20% so we set 2 key
attributes, one at 20% and other at 25%. -->
<KeyAttribute
android:elevation="@dimen/details_poster_elevation"
android:rotation="45"
android:rotationY="15"
app:framePosition="20"
app:target="@id/details_poster" />
<KeyAttribute
android:elevation="@dimen/details_poster_not_elevation"
app:framePosition="25"
app:target="@id/details_poster" />
<!-- Only elevate the appbar background over the last 25% -->
<KeyAttribute
android:elevation="0dp"
app:framePosition="75"
app:target="@id/details_appbar_background" />
<!-- We want the subtitle to fade out quickly, within the starting 75% -->
<KeyAttribute
android:alpha="0"
app:framePosition="75"
app:target="@id/details_subtitle" />
</KeyFrameSet>
</Transition>
<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@id/details_backdrop"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@id/details_appbar_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Constraint
android:id="@id/details_backdrop_scrim"
app:layout_constraintBottom_toBottomOf="@id/details_backdrop"
app:layout_constraintEnd_toEndOf="@id/details_backdrop"
app:layout_constraintStart_toStartOf="@id/details_backdrop"
app:layout_constraintTop_toTopOf="@id/details_backdrop">
<CustomAttribute
app:attributeName="background"
app:customColorDrawableValue="@android:color/transparent" />
</Constraint>
<Constraint
android:id="@id/details_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
app:layout_constraintTop_toBottomOf="@id/details_status_bar_anchor">
<CustomAttribute
app:attributeName="iconTint"
app:customColorValue="?android:attr/textColorPrimaryInverse" />
</Constraint>
<Constraint
android:id="@id/details_appbar_background"
android:layout_width="0dp"
android:layout_height="88dp"
app:layout_constraintBottom_toBottomOf="@id/details_poster"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Constraint
android:id="@id/details_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
app:layout_constraintBottom_toTopOf="@id/details_subtitle"
app:layout_constraintEnd_toEndOf="@id/details_appbar_background"
app:layout_constraintStart_toEndOf="@id/details_poster"
app:layout_constraintTop_toBottomOf="@id/details_appbar_background" />
<Constraint
android:id="@id/details_subtitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
app:layout_constraintBottom_toTopOf="@id/details_appbar_background"
app:layout_constraintEnd_toEndOf="@id/details_appbar_background"
app:layout_constraintStart_toEndOf="@id/details_poster"
app:layout_constraintTop_toBottomOf="@id/details_title" />
<Constraint
android:id="@id/details_poster"
android:layout_width="80dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="200dp"
android:elevation="@dimen/details_poster_elevation"
app:layout_constraintDimensionRatio="h,1:1.5"
app:layout_constraintStart_toStartOf="@id/details_rv"
app:layout_constraintTop_toTopOf="parent" />
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@id/details_backdrop"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@id/details_appbar_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Constraint
android:id="@id/details_backdrop_scrim"
app:layout_constraintBottom_toBottomOf="@id/details_backdrop"
app:layout_constraintEnd_toEndOf="@id/details_backdrop"
app:layout_constraintStart_toStartOf="@id/details_backdrop"
app:layout_constraintTop_toTopOf="@id/details_backdrop">
<CustomAttribute
app:attributeName="background"
app:customColorDrawableValue="@color/status_bar_scrim_translucent_dark" />
</Constraint>
<Constraint
android:id="@id/details_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="@dimen/details_appbar_elevation"
app:layout_constraintTop_toBottomOf="@id/details_status_bar_anchor">
<CustomAttribute
app:attributeName="iconTint"
app:customColorValue="?android:attr/textColorPrimary" />
</Constraint>
<Constraint
android:id="@id/details_appbar_background"
android:layout_width="0dp"
android:layout_height="?android:attr/actionBarSize"
android:elevation="@dimen/details_appbar_elevation"
app:layout_constraintEnd_toEndOf="@id/details_rv"
app:layout_constraintStart_toStartOf="@id/details_rv"
app:layout_constraintTop_toBottomOf="@id/details_status_bar_anchor" />
<Constraint
android:id="@id/details_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:layout_marginStart="64dp"
android:elevation="@dimen/details_appbar_elevation"
app:layout_constraintBottom_toBottomOf="@id/details_appbar_background"
app:layout_constraintEnd_toEndOf="@id/details_appbar_background"
app:layout_constraintStart_toStartOf="@id/details_appbar_background"
app:layout_constraintTop_toTopOf="@id/details_appbar_background" />
<Constraint
android:id="@id/details_subtitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:elevation="@dimen/details_appbar_elevation"
android:visibility="invisible"
android:alpha="0"
app:layout_constraintEnd_toEndOf="@id/details_title"
app:layout_constraintStart_toStartOf="@id/details_title"
app:layout_constraintTop_toBottomOf="@id/details_title" />
<Constraint
android:id="@id/details_poster"
android:layout_width="72dp"
android:layout_height="0dp"
android:elevation="@dimen/details_poster_not_elevation"
app:layout_constraintDimensionRatio="h,1:1.5"
app:layout_constraintStart_toStartOf="@id/details_title"
app:layout_constraintTop_toBottomOf="@id/details_status_bar_anchor" />
</ConstraintSet>
</MotionScene>