-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·711 lines (584 loc) · 21.6 KB
/
index.html
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
<!doctype html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
<title>Multi Screen Hell</title>
<meta name="description" content="Multi Screen Hell in Android Presentation">
<meta name="author" content="Abdullah Cetin CAVDAR">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="reveal/css/reveal.min.css">
<link rel="stylesheet" href="reveal/css/theme/night.css" id="theme">
<link rel="stylesheet" href="css/style.css">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="reveal/lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write('<link rel="stylesheet" href="reveal/css/print/' + ( window.location.search.match(/print-pdf/gi) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">');
</script>
<!--[if lt IE 9]>
<script src="reveal/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>Multi Screen Hell</h1>
<h3>DevFest 2013, Ankara</h3>
<p>
<a href="http://cavdar.net" target="_blank">Abdullah Cetin CAVDAR</a> / <a
href="http://twitter.com/accavdar" target="_blank">@accavdar</a>
</p>
</section>
<section>
<section>
<h1>Why Hell?</h1>
</section>
<section>
<h1>Manufacturers</h1>
<ul>
<li>Acer</li>
<li>Asus</li>
<li>HTC</li>
<li>LG</li>
<li>Motorola</li>
<li>Samsung</li>
<li>Sony</li>
<li>...</li>
</ul>
</section>
<section>
<h1>Fragmentation</h1>
<img src="img/manufacturers.png"/>
</section>
<section>
<h1>Device Types</h1>
<h2><span class="focus">11.868</span> distinct Android devices seen in 2013</h2>
<p>
<a href="http://opensignal.com/reports/fragmentation-2013/fragmentation-2013.pdf">Open Signal
Fragmentation Report 2013</a>
</p>
</section>
<section>
<h1>Phones</h1>
<img src="img/phones.jpg"/>
</section>
<section>
<h1>Tablets</h1>
<img src="img/tablets.jpg"/>
</section>
<section>
<h1>Laptops</h1>
<img src="img/laptops.png"/>
</section>
<section>
<h1>TV</h1>
<img src="img/tv.png"/>
</section>
<section>
<h1>Set-Top-Box</h1>
<img src="img/stb.jpg"/>
</section>
<section>
<h1>Consoles</h1>
<img src="img/consoles.jpg"/>
</section>
<section>
<h1>Everywhere</h1>
<h2>Internet of Things (IoT)?</h2>
<img src="img/iot.jpg"/>
<p>
<a href="http://www.businessweek.com/articles/2013-05-29/behind-the-internet-of-things-is-android-and-its-everywhere">Behind
the 'Internet of Things' Is Android and It's Everywhere</a>
</p>
</section>
<section>
<h1>Size & Resolution</h1>
<p class="fragment roll-in">2.8 in, 3.2 in, 3.5 in, 3.6 in, 3.7 in, 4.0 in, 4.3 in, 4.5 in, 4.7 in, 4.8
in, 5.0 in, 6.4 in, 7.0, 9.7 in, 10.1 in, ...</p>
<p class="fragment roll-in">320x240 QVGA, 480x320 HVGA, 800x480 WVGA, 960x540 qHD, 1280x768 WXGA,
1280x720 HD, 1920x1080 HD, ...</p>
<img class="fragment roll-in" src="img/screen_sizes.png"/>
</section>
<section>
<h1>API Versions</h1>
<img src="img/platform_versions.png"/>
<p>
<a href="http://developer.android.com/about/dashboards/index.html">Android Dashboards</a>
</p>
</section>
<section>
<h1>Orientation</h1>
<h2>Landscape or Portrait?</h2>
</section>
<section data-background="img/didier.png">
<h2 class="drogba">Keep Calm</h2>
<h2 class="drogba">and</h2>
<h1 class="drogba">Çare Drogba</h1>
</section>
</section>
<section>
<section>
<h1>Supporting</h1>
<h1>Multiple Screens</h1>
</section>
<section>
<h2>Range of Screens Supported</h2>
<ul>
<li><span class="focus">sizes:</span> small, normal, large, and xlarge</li>
<li><span class="focus">densities:</span> ldpi (low), mdpi (medium), hdpi (high),
and xhdpi (extra high)
</li>
</ul>
</section>
<section>
<h2>Size and Density Group</h2>
<img src="img/screens_ranges.png"/>
</section>
<section>
<h2>Density-independent Pixel (dp)</h2>
<p>
A <span class="focus">virtual pixel unit</span> that you should use when defining UI layout, to express
layout dimensions or position in a <span class="focus">density-independent</span> way.
</p>
<p>
The <span class="focus">density-independent pixel</span> is equivalent to <span
class="focus">one physical pixel</span>
on a <span class="focus">160 dpi</span> screen (medium density)
</p>
</section>
<section>
<h2>Conversion</h2>
<h3><span class="focus">px = dp * (dpi / 160)</span></h3>
<h4>Ex: on a 240 dpi screen, 1 dp equals 1.5 physical pixels</h4>
</section>
<section>
<h2>Density Independence</h2>
<p>
It <span class="focus">preserves</span> the <span class="focus">physical size</span> of user interface
elements when displayed on screens with <span class="focus">different densities</span>
</p>
<ul>
<li>The system scales <span class="focus">dp units</span> as appropriate for the
current screen density
</li>
<li>The system <span class="focus">scales drawable resources</span> to the
appropriate size, based on the
current screen density, if necessary
</li>
</ul>
</section>
<section>
<h2><span class="alert">Bad</span></h2>
<img src="img/density_bad.png"/>
<h2><span class="success">Good</span></h2>
<img src="img/density_good.png"/>
</section>
<section>
<h2>How to Support Multiple Screens?</h2>
</section>
<section>
<h2>Use <span class="focus"><supports-screen></span>
</h2>
<p>Explicitly declare in the manifest which screen sizes your application supports </p>
<img src="img/supports_screen.png"/>
</section>
<section>
<h2>Provide different layouts for different screen sizes</h2>
<ul>
<li>
Provide size-specific resources: <span class="focus">small</span>, <span class="focus">normal</span>,
<span class="focus">large</span>, and <span class="focus">xlarge</span>
<ul>
<li>Ex: <span class="focus">layout-xlarge/</span></li>
</ul>
</li>
<li>Use the <span class="focus">sw<N>dp</span> configuration qualifier to
define the smallest available
width (beginning API 13)
<ul>
<li>Ex: <span class="focus">layout-sw600dp/</span> (at least 600dp screen width)</li>
</ul>
</li>
</ul>
</section>
<section>
<h2>Provide different bitmaps</h2>
<ul>
<li>
By default, Android scales drawables (<span class="focus">.png</span>, <span class="focus">.jpg</span>,
<span class="focus">.gif</span> and <span class="focus">.9.png</span> files)
</li>
<li>Include <span class="focus">alternative versions</span>
at <span class="focus">different resolutions</span> for <span
class="focus">different screen densities</span>
</li>
<li>
Density-specific resources are <span class="focus">ldpi</span> (low), <span class="focus">mdpi</span>
(medium), <span class="focus">hdpi</span> (high), and <span class="focus">xhdpi</span> (extra high)
<ul>
<li>Ex: <span class="focus">drawable-hdpi/</span></li>
</ul>
</li>
</ul>
</section>
<section>
<h2>Configuration Qualifiers</h2>
<h3>Usage: <span class="focus"><resources_name>-<qualifier></span></h3>
<ul>
<li>
<span class="focus"><resources_name></span> is the standard resource name (such as <span
class="focus">drawable</span> or <span class="focus">layout</span>)
</li>
<li>
<span class="focus"><qualifier></span> is a configuration qualifier (such as <span
class="focus">hdpi</span>
or <span class="focus">xlarge</span>)
</li>
</ul>
</section>
<section>
<h2>Layouts & Drawables</h2>
<img src="img/cq.png"/>
</section>
<section>
<h2>Alternative Drawables</h2>
<ul>
<li>
You only need to provide density-specific drawables (<span class="focus">.png</span>, <span
class="focus">.jpg</span>, <span class="focus">.gif</span> or <span class="focus">.9.png</span>)
</li>
<li>
Follow the <span class="focus">3:4:6:8</span> scaling ratio between the four generalized densities
<ul>
<li>36x36 for low-density</li>
<li>48x48 for medium-density</li>
<li>72x72 for high-density</li>
<li>96x96 for extra high-density</li>
</ul>
</li>
<li>See <a
href="http://developer.android.com/guide/practices/ui_guidelines/icon_design.html">Icon Design
Guideline</a>
</li>
</ul>
</section>
<section>
<h2>Relative Sizes</h2>
<img src="img/screens_densities.png"/>
</section>
<section>
<h2>Tablet Layouts for Android 3.2</h2>
<p>Android 3.2 introduces a new way to specify resources for <span class="focus">more discrete screen sizes</span>
</p>
</section>
<section>
<h2>New Size Qualifiers</h2>
<ul>
<li>
smallestWidth: <span class="focus">sw<N>dp</span>
<ul>
<li>Ex: <span class="focus">sw600dp</span></li>
</ul>
</li>
<li>Available screen width: <span class="focus">w<N>dp</span>
<ul>
<li>Ex: <span class="focus">w1024dp</span></li>
</ul>
</li>
<li>Available screen height: <span class="focus">h<N>dp</span>
<ul>
<li>Ex: <span class="focus">h720dp</span></li>
</ul>
</li>
</ul>
</section>
<section>
<h2>Configuration Examples</h2>
<img src="img/sw.png"/>
<img src="img/aw.png"/>
</section>
<section>
<h1>Best Practises</h1>
</section>
<section>
<h2>1. Use <span class="focus">wrap_content</span>, <span class="focus">match_parent</span>, or the <span
class="focus">dp unit</span> for layout dimensions</h2>
<p>Using <span class="focus">wrap_content</span>, <span class="focus">match_parent</span> or <span class="focus">dp units</span>
guarantees that the view is given an appropriate size on the current device screen</p>
<p>PS: Use <span class="focus">sp</span> for font sizes</p>
</section>
<section>
<h2>2. Do not use hard-coded pixel values in your application code</h2>
</section>
<section>
<h2>3. Use RelativeLayout</h2>
<p>It uses <span class="focus">relative positioning</span> to lay out its child views</p>
<p>For instance, you can specify that a button widget should appear <span class="focus">"to the right of"</span> a
text widget</p>
</section>
<section>
<h2>4. Use size and density-specific resources</h2>
<img src="img/drawable_qualifiers.png"/>
<p>PS: To avoid pre-scaling, put the resource in a resource directory with the <span class="focus">nodpi</span>
configuration qualifier</p>
</section>
<section>
<h2>5. Use Nine-patch Bitmaps</h2>
<p>They are specially formatted PNG files that indicate which areas <span
class="focus">can and cannot be stretched</span></p>
<img src="img/nine_patch.png"/>
</section>
</section>
<section>
<section>
<h1>Tablets</h1>
<h1>&</h1>
<h1>Handsets</h1>
</section>
<section>
<h1>Basic Guideline</h1>
</section>
<section>
<h2>1. Build your activity designs based on <span class="focus">Fragments</span></h2>
</section>
<section>
<h1>Fragment</h1>
<ul>
<li>Introduced in Android 3.0 (API Level 11)</li>
<li>It allows you to separate distinct behavioral components of your UI into
separate parts
</li>
<li>Provides <span class="focus">modular</span> UI development</li>
<li>PS: Use Android <a
href="http://developer.android.com/tools/support-library/index.html">Support Libraries</a> to use
fragments in older Android versions
</li>
</ul>
</section>
<section>
<h2>Multiple Fragments, Multiple Activities</h2>
<img src="img/fragments.png"/>
</section>
<section>
<h2>Handsets</h2>
<p><span class="focus">res/layout/main.xml</span></p>
<img src="img/handset.png"/>
</section>
<section>
<h2>Tablets</h2>
<p><span class="focus">res/layout-large/main.xml</span></p>
<img src="img/tablet.png"/>
<p>PS: You should also use the new <span class="focus">minimum width</span> size qualifiers in order to more
precisely control the screen size</p>
</section>
<section>
<h2>How does it work?</h2>
<ul>
<li>If Fragment B is in the layout, Activity A notifies Fragment B to update
itself
</li>
<li>If Fragment B is not in the layout, Activity A starts Activity B (which hosts
Fragment B)
</li>
<li>Important Note: <span class="focus">Define a callback interface in each fragment class</span>
to communicate with host activity
</li>
</ul>
</section>
<section>
<h2>2. Use the <span class="focus">Action Bar</span></h2>
<p>The action bar is a window feature that <span class="focus">Action Bar</span>identifies the user
location</span>, and <span class="focus">Action Bar</span>provides user actions</span> and
<span class="focus">Action Bar</span>navigation modes</span></p>
<img src="img/actionbar.png"/>
<p>Introduced in Android 3.0 (API Level 11). However, you can use t using Android <a
href="http://developer.android.com/tools/support-library/index.html">Support Libraries</a></p>
</section>
<section>
<h2>Why Action Bar?</h2>
<p>Android system does all the work to <span class="focus">gracefully adapt the action bar</span> for <span
class="focus">different screen sizes</span></p>
<img class="fragment roll-in" src="img/ab_wide_narrow.png"/>
</section>
<section>
<h2>Tips for creating <span class="focus">Action Bar</span></h2>
</section>
<section>
<h2>1. Avoid using the <span class="focus">always</span> value</h2>
<ul>
<li>Forcing too many action items into the action bar can create a cluttered UI
</li>
<li>Action items may overlap with other action bar elements such as the title or
navigation items
</li>
<li>Use <span class="focus">ifRoom</span> for the <span class="focus">android:showAsAction</span>
attribute
</li>
</ul>
</section>
<section>
<h2>2. Provide an <span class="focus">Icon</span></h2>
<ul>
<li>Always provide an icon for the action items</li>
<li>Use <span class="focus">showAsAction="ifRoom|withText"</span></li>
</ul>
</section>
<section>
<h2>3. Provide a <span class="focus">Title</span></h2>
<ul>
<li>Always provide a title</li>
<li>Users view the title as a <span class="focus">tooltip</span> on long-click</li>
<li>It is critical for <span class="focus">accessibility</span>: Screen readers
read aloud the item title even when not visisble
</li>
</ul>
</section>
<section>
<h2>4. Avoid using custom navigation modes when possible</h2>
<ul>
<li>Use the built-in tab and drop-down navigation modes when possible</li>
<li>System can adapt their presentation to different screen sizes automatically
<ul>
<li>Ex: <span class="focus">stacked action bar</span> in handsets</li>
</ul>
</li>
</ul>
</section>
<section>
<h2>Split Action Bar</h2>
<ul>
<li>Available in Android 4.0 (API level 14) and higher</li>
<li>Add <span class="focus">uiOptions="splitActionBarWhenNarrow"</span> to your
<span class="focus"><activity></span> or <span class="focus"><application></span> manifest
element
</li>
<li>Call <span class="focus">setDisplayShowHomeEnabled(false)</span> to disable the
application icon in the
action bar
</li>
</ul>
<img src="img/split_ab.png"/>
</section>
</section>
<section>
<section>
<h1>Testing</h1>
</section>
<section>
<h2>Use Emulator with different configs</h2>
<p><span class="focus">emulator -avd <avd_name> -scale 96dpi</span></p>
<img src="img/emulator.png"/>
</section>
<section>
<h2>Android Studio</h2>
<p>Built in device previews (landscape and portrait modes)</p>
<img src="img/android_studio.png"/>
</section>
</section>
<section>
<section>
<h1>Compatibility</h1>
<p>Most important characteristic of a compatible device is the ability to <span
class="focus">install</span> and <span class="focus">correctly run</span> an Android .apk file
</p>
</section>
<section>
<h2>Apps Availability</h2>
<h3><span class="focus"><uses-feature></span> in manifest file</h3>
<pre>
<code class="xml" contenteditable="false" data-trim>
<uses-feature android:name="android.hardware.bluetooth" />
<uses-feature android:name="android.hardware.camera" />
</code>
</pre>
<p>
The other <span class="focus">filters</span> for apps availability in Google Play:
<ul>
<li><supports-gl-texture></li>
<li><uses-configuration></li>
<li><uses-library></li>
<li><uses-permission></li>
<li><uses-sdk></li>
</ul>
</p>
</section>
<section>
<h2>Package Manager</h2>
<h3>Check feature availabilities at runtime</h3>
<pre>
<code class="java" contenteditable="false" data-trim>
PackageManager packageManager = this.getPackageManager();
if (packageManager.hasSystemFeature(PackageManager.FEATURE_NFC)) {
Log.d(TAG, "Oh yeah, NFC is available. :)");
} else {
Log.d(TAG, "Shit, no NFC. :(");
}
</code>
</pre>
</section>
<section>
<h1>Business Reasons</h1>
<ul>
<li>List the countries an app is available in</li>
<li>Select which carrier’s users are able to access the app</li>
</ul>
</section>
</section>
<section>
<section>
<h1>Slides</h1>
<a href="https://github.com/accavdar/MultiScreenHell"
target="_blank">http://github.com/accavdar/MultiScreenHell</a>
</section>
</section>
<section>
<h1>Questions?</h1>
</section>
<section>
<section data-transition="linear" data-background="#4d7e65"
data-background-transition="slide">
<h1>THE END</h1>
<h3 class="inverted">by Abdullah Cetin CAVDAR / <a href="http://twitter.com/accavdar"
target="_blank">@accavdar</a>
</h3>
</section>
</section>
</div>
</div>
<script src="reveal/lib/js/head.min.js"></script>
<script src="reveal/js/reveal.min.js"></script>
<script>
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
dependencies: [
{ src: 'reveal/lib/js/classList.js', condition: function () {
return !document.body.classList;
} },
{ src: 'reveal/plugin/markdown/marked.js', condition: function () {
return !!document.querySelector('[data-markdown]');
} },
{ src: 'reveal/plugin/markdown/markdown.js', condition: function () {
return !!document.querySelector('[data-markdown]');
} },
{ src: 'reveal/plugin/highlight/highlight.js', async: true, callback: function () {
hljs.initHighlightingOnLoad();
} },
{ src: 'reveal/plugin/zoom-js/zoom.js', async: true, condition: function () {
return !!document.body.classList;
} },
{ src: 'reveal/plugin/notes/notes.js', async: true, condition: function () {
return !!document.body.classList;
} }
]
});
</script>
</body>
</html>