32
32
android : layout_width =" match_parent"
33
33
android : layout_height =" match_parent"
34
34
android : fillViewport =" true" >
35
- <!--
36
- FIXME =============================================================================
37
- TODO: Re-organize elements according to UI flow
38
- FIXME =============================================================================
39
- -->
40
35
41
36
<androidx .constraintlayout.widget.ConstraintLayout
42
37
android : layout_width =" match_parent"
43
38
android : layout_height =" match_parent" >
44
39
45
40
41
+ <!-- Vertical guideline to separate the labels and text fields
42
+ from left and right edge of the screen. -->
43
+ <androidx .constraintlayout.widget.Guideline
44
+ android : id =" @+id/guideline_vertical_left"
45
+ android : layout_width =" 0dp"
46
+ android : layout_height =" 0dp"
47
+ android : orientation =" vertical"
48
+ app : layout_constraintGuide_percent =" 0.05" />
49
+
50
+ <androidx .constraintlayout.widget.Guideline
51
+ android : id =" @+id/guideline_vertical_right"
52
+ android : layout_width =" 0dp"
53
+ android : layout_height =" 0dp"
54
+ android : orientation =" vertical"
55
+ app : layout_constraintGuide_percent =" 0.95" />
56
+
57
+ <!-- ================ End of vertical guideline ================== -->
58
+
59
+
60
+ <!--
61
+ A black view that covers the full width to match the thumbnail extra space
62
+ This is required because the thumbnail is constraint by aspect ratio, so
63
+ when in landscape mode, the thumbnail does not stretch and maintains aspect ratio.
64
+ -->
65
+ <View
66
+ android : layout_width =" 0dp"
67
+ android : layout_height =" @dimen/ted_talk_thumbnail_height"
68
+ android : background =" @color/md_black_1000"
69
+ app : layout_constraintEnd_toEndOf =" parent"
70
+ app : layout_constraintStart_toStartOf =" parent"
71
+ app : layout_constraintTop_toTopOf =" parent" />
72
+
73
+ <ImageView
74
+ android : id =" @+id/video_player_thumbnail"
75
+ android : layout_width =" 0dp"
76
+ android : layout_height =" @dimen/ted_talk_thumbnail_height"
77
+ android : src =" @drawable/thumb_ted_talk"
78
+ app : layout_constraintDimensionRatio =" W,16:9"
79
+ app : layout_constraintEnd_toEndOf =" @id/guideline_vertical_right"
80
+ app : layout_constraintStart_toStartOf =" @id/guideline_vertical_left"
81
+ app : layout_constraintTop_toTopOf =" parent"
82
+ tools : background =" #888" />
83
+
84
+ <!-- ========= End of Thumbnail Related Views ============ -->
85
+
86
+
87
+ <!--
88
+ Begin Video Content Title and Subtitle
89
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90
+ -->
91
+ <TextView
92
+ android : id =" @+id/author"
93
+ style =" @style/TextAppearance.AppCompat.Small"
94
+ android : layout_width =" 0dp"
95
+ android : layout_height =" wrap_content"
96
+ android : layout_marginTop =" 24dp"
97
+ android : gravity =" center_horizontal"
98
+ android : text =" Roger Hanlon"
99
+ app : layout_constraintEnd_toEndOf =" @id/guideline_vertical_right"
100
+ app : layout_constraintStart_toStartOf =" @id/guideline_vertical_left"
101
+ app : layout_constraintTop_toBottomOf =" @+id/video_player_thumbnail" />
102
+
103
+ <TextView
104
+ android : id =" @+id/talk_title"
105
+ style =" @style/TextAppearance.AppCompat.Title"
106
+ android : layout_width =" 0dp"
107
+ android : layout_height =" wrap_content"
108
+ android : layout_marginTop =" 8dp"
109
+ android : gravity =" center_horizontal"
110
+ android : text =" The amazing brains and morphing skin of octopuses and other cephalopods"
111
+ app : layout_constraintEnd_toEndOf =" @id/guideline_vertical_right"
112
+ app : layout_constraintStart_toStartOf =" @id/guideline_vertical_left"
113
+ app : layout_constraintTop_toBottomOf =" @+id/author" />
114
+
115
+ <!-- ========= End of Title and Subtitle Related Views ============ -->
116
+
117
+
118
+ <!--
119
+ Begin Playback Control Views
120
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
121
+ All the controls (Skip Next, Prev, Play, etc) are chained together horizontally
122
+ Chain style is "packed" so they always stick together even in landscape orientation.
123
+ -->
124
+
46
125
<ImageButton
47
126
48
127
android : id =" @+id/action_prev_track"
75
154
76
155
77
156
<ImageButton
78
-
79
157
android : id =" @+id/action_play_pause"
80
158
style =" @style/Widget.AppCompat.Button.Borderless"
81
159
android : layout_width =" 78dp"
119
197
app : layout_constraintStart_toEndOf =" @+id/action_forward15"
120
198
app : layout_constraintTop_toTopOf =" @+id/action_forward15" />
121
199
122
-
123
- <!-- A black view that covers the full witdth to match the thumbnail extra space -->
124
- <View
125
- android : layout_width =" 0dp"
126
- android : layout_height =" 220dp"
127
- android : background =" @color/md_black_1000"
128
- app : layout_constraintEnd_toEndOf =" parent"
129
- app : layout_constraintStart_toStartOf =" parent"
130
- app : layout_constraintTop_toTopOf =" parent" />
131
- <ImageView
132
- android : id =" @+id/video_player_thumbnail"
133
- android : layout_width =" 0dp"
134
- android : layout_height =" 220dp"
135
- android : src =" @drawable/thumb_ted_talk"
136
- app : layout_constraintDimensionRatio =" W,16:9"
137
- app : layout_constraintEnd_toEndOf =" @id/guideline_vertical_right"
138
- app : layout_constraintStart_toStartOf =" @id/guideline_vertical_left"
139
- app : layout_constraintTop_toTopOf =" parent"
140
- tools : background =" #888" />
200
+ <!-- ========= End of Playback Control Related Views ============ -->
141
201
142
202
203
+ <!--
204
+ Begin Playback Time Seekbar and Time Preview
205
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
206
+ Seekbar and time labels are also chained together horizontally
207
+ The seekbar takes the maximum available space.
208
+ -->
143
209
144
210
<SeekBar
145
211
android : id =" @+id/progressBar"
153
219
app : layout_constraintStart_toEndOf =" @+id/time_elapsed"
154
220
app : layout_constraintTop_toBottomOf =" @+id/action_play_pause" />
155
221
156
-
157
- <TextView
158
- android : id =" @+id/talk_title"
159
- style =" @style/TextAppearance.AppCompat.Title"
160
- android : layout_width =" 0dp"
161
- android : layout_height =" wrap_content"
162
- android : layout_marginTop =" 8dp"
163
- android : gravity =" center_horizontal"
164
- android : text =" The amazing brains and morphing skin of octopuses and other cephalopods"
165
- app : layout_constraintEnd_toEndOf =" @id/guideline_vertical_right"
166
- app : layout_constraintStart_toStartOf =" @id/guideline_vertical_left"
167
- app : layout_constraintTop_toBottomOf =" @+id/author" />
168
-
169
-
170
- <TextView
171
- android : id =" @+id/author"
172
- style =" @style/TextAppearance.AppCompat.Small"
173
- android : layout_width =" 0dp"
174
- android : layout_height =" wrap_content"
175
- android : layout_marginTop =" 24dp"
176
- android : gravity =" center_horizontal"
177
- android : text =" Roger Hanlon"
178
- app : layout_constraintEnd_toEndOf =" @id/guideline_vertical_right"
179
- app : layout_constraintStart_toStartOf =" @id/guideline_vertical_left"
180
- app : layout_constraintTop_toBottomOf =" @+id/video_player_thumbnail" />
181
-
182
222
<TextView
183
223
android : id =" @+id/time_elapsed"
184
224
android : layout_width =" wrap_content"
201
241
app : layout_constraintStart_toEndOf =" @+id/progressBar"
202
242
app : layout_constraintTop_toTopOf =" @+id/progressBar" />
203
243
244
+ <!-- ========= End of Playback Seekbar Related Views ============ -->
245
+
246
+
247
+ <!--
248
+ Begin About Author Section
249
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
250
+ Most of the views are stacked one after another vertically.
251
+ The author name and position is chaned vertically and centered with the thumbnail image.
252
+ -->
253
+
254
+ <TextView
255
+ android : id =" @+id/author_section_title"
256
+ style =" @style/TextAppearance.AppCompat.Large"
257
+ android : layout_width =" wrap_content"
258
+ android : layout_height =" wrap_content"
259
+ android : layout_marginTop =" 16dp"
260
+ android : text =" About the speaker"
261
+ app : layout_constraintLeft_toLeftOf =" @id/guideline_vertical_left"
262
+ app : layout_constraintTop_toBottomOf =" @id/content_divider_top" />
263
+
264
+
204
265
<ImageView
205
266
android : id =" @+id/author_thumbnail"
206
- android : layout_width =" 48dp "
207
- android : layout_height =" 48dp "
267
+ android : layout_width =" wrap_content "
268
+ android : layout_height =" wrap_content "
208
269
android : layout_marginTop =" 8dp"
209
- android : background =" @drawable/circle "
270
+ android : background =" @drawable/thumb_roger_hanlon "
210
271
app : layout_constraintLeft_toRightOf =" @id/guideline_vertical_left"
211
272
app : layout_constraintTop_toBottomOf =" @id/author_section_title" />
212
273
213
274
214
- <Space
215
- android : layout_width =" 0dp"
216
- android : layout_height =" 20dp"
217
- app : layout_constraintLeft_toLeftOf =" parent"
218
- app : layout_constraintRight_toRightOf =" parent"
219
- app : layout_constraintTop_toBottomOf =" @id/content_divider_bottom" />
220
-
221
275
<TextView
222
276
android : id =" @+id/author_name"
223
277
style =" @style/TextAppearance.AppCompat.Body1"
224
278
android : layout_width =" wrap_content"
225
279
android : layout_height =" wrap_content"
226
280
android : layout_marginStart =" 16dp"
227
- android : text =" Neha Madhira and Haley Stack "
281
+ android : text =" Roger Hanlon "
228
282
android : textStyle =" bold"
229
283
app : layout_constraintBottom_toTopOf =" @+id/author_title"
230
284
app : layout_constraintLeft_toRightOf =" @id/author_thumbnail"
249
303
android : hyphenationFrequency =" full"
250
304
android : text =" As a Senior Scientist at the Marine Biological Laboratory in Woods Hole, Massachusetts, Roger Hanlon delves into the undersea world of chameleon-like, color-changing marine animals — and the practical applications that will emerge when we crack their secrets."
251
305
app : layout_constraintLeft_toRightOf =" @id/guideline_vertical_left"
252
-
253
306
app : layout_constraintRight_toLeftOf =" @id/guideline_vertical_right"
254
307
app : layout_constraintTop_toBottomOf =" @id/author_thumbnail" />
255
308
256
- <TextView
257
- android : id =" @+id/author_section_title"
258
- style =" @style/TextAppearance.AppCompat.Large"
259
- android : layout_width =" wrap_content"
260
- android : layout_height =" wrap_content"
261
- android : layout_marginTop =" 16dp"
262
- android : text =" About the speaker"
263
- app : layout_constraintLeft_toLeftOf =" @id/guideline_vertical_left"
264
- app : layout_constraintTop_toBottomOf =" @id/content_divider_top" />
265
309
310
+ <!-- Horizontal line at top and bottom of author info views -->
266
311
<View
267
- android : id =" @+id/content_divider_bottom "
312
+ android : id =" @+id/content_divider_top "
268
313
android : layout_width =" 0dp"
269
314
android : layout_height =" 1dp"
270
- android : layout_marginTop =" 16dp "
271
- android : background =" @color/md_grey_400 "
315
+ android : layout_marginTop =" 32dp "
316
+ android : background =" @color/md_grey_300 "
272
317
app : layout_constraintLeft_toLeftOf =" @id/guideline_vertical_left"
273
318
app : layout_constraintRight_toRightOf =" @id/guideline_vertical_right"
274
- app : layout_constraintTop_toBottomOf =" @id/author_description" />
275
-
319
+ app : layout_constraintTop_toBottomOf =" @id/progressBar" />
276
320
277
321
<View
278
- android : id =" @+id/content_divider_top "
322
+ android : id =" @+id/content_divider_bottom "
279
323
android : layout_width =" 0dp"
280
324
android : layout_height =" 1dp"
281
- android : layout_marginTop =" 32dp "
282
- android : background =" @color/md_grey_400 "
325
+ android : layout_marginTop =" 16dp "
326
+ android : background =" @color/md_grey_300 "
283
327
app : layout_constraintLeft_toLeftOf =" @id/guideline_vertical_left"
284
328
app : layout_constraintRight_toRightOf =" @id/guideline_vertical_right"
285
- app : layout_constraintTop_toBottomOf =" @id/progressBar" />
286
-
287
- <!-- Vertical guideline to separate the labels and text fields. -->
288
- <androidx .constraintlayout.widget.Guideline
289
- android : id =" @+id/guideline_vertical_left"
290
- android : layout_width =" 0dp"
291
- android : layout_height =" 0dp"
292
- android : orientation =" vertical"
293
- app : layout_constraintGuide_percent =" 0.05" />
329
+ app : layout_constraintTop_toBottomOf =" @id/author_description" />
294
330
295
- <androidx .constraintlayout.widget.Guideline
296
- android : id =" @+id/guideline_vertical_right"
331
+ <Space
297
332
android : layout_width =" 0dp"
298
- android : layout_height =" 0dp"
299
- android : orientation =" vertical"
300
- app : layout_constraintGuide_percent =" 0.95" />
301
-
302
- <!-- ================================= End of vertical guideline ================================= -->
303
-
333
+ android : layout_height =" 20dp"
334
+ app : layout_constraintLeft_toLeftOf =" parent"
335
+ app : layout_constraintRight_toRightOf =" parent"
336
+ app : layout_constraintTop_toBottomOf =" @id/content_divider_bottom" />
304
337
305
338
</androidx .constraintlayout.widget.ConstraintLayout>
306
339
</androidx .core.widget.NestedScrollView>
0 commit comments