infinum android talks #03 - android design best practices - for designers and developers

34
Android Talks #3 Android Design Best Practices - for Designers and Developers Marko Vitas

Upload: infinum-ltd

Post on 02-Jul-2015

160 views

Category:

Technology


3 download

DESCRIPTION

The goal of the presentation is to improve the level of cooperation between designers and developers. Designers will get a look at how the layout designing process for Android works. In turn, developers will learn best practices to better handle design changes and improve code quality. We've discussed the presentation in advance with both developers and designers, to pinpoint the topics that are of real interest to both parties.

TRANSCRIPT

Page 1: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Android Talks #3 Android Design Best Practices - for Designers and Developers

Marko Vitas

Page 2: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Scope

• Motivation!

• Supporting multiple screen sizes!

• Smart & flexible design approach !

• Custom components

Page 3: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Motivation

• Tired of not knowing what dpi, dp and sp mean?!

• Having nightmares of “little” design changes that affect the whole app? (fonts? styles? themes?) !

• Designers and developers, lets make each others life better.!

• Lets define a standard

Page 4: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Supporting Multiple Screen Sizes

Page 5: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

How Do Designers Prepare Materials?

• Vector graphics !

• Scale up/down!

• Exporting graphics for different screen densities!

• What does all of this mean for Android?

Page 6: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

dpi

• screen density = horizontal width (resolution in px) / actual physical size in inches!

• dpi (dots per inch) i.e. ppi (pixels per inch)!

• density buckets: 120,160, 240, 320, 480, 640 3 : 4 : 6 : 8 : 12 : 16!

• tvdpi 213dpi

Page 7: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

dp• A virtual pixel unit !

• Use when defining UI layout, to express layout dimensions or position in a density-independent way.!

• pixels = dps * (density / 160)!

• Designers use the baseline (mdpi) density !

• Developers use the exported screens and calculate the width & height in pixels which map directly to dp

Page 8: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

sp (I)

• dp has constant ratio transition dp = px * ratio.!

• sp = px * ratio * scale.!

• sp = dp * scale!

• Accessibility purpose!

• User system settings in display —> fonts

Page 9: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

sp (II)

Page 10: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

dpi / dp / sp

Page 11: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Smart & Flexible Design Approach

Page 12: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Layout Types (I) Linear

Page 13: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Layout Types (II) - Relative

Page 14: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Drawables• Animation drawable!

• Transition drawable!

• Level list drawable!

• Selector drawable !

• Graphic!

• 9Patch

Page 15: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

9patch

• Click within the 1-pixel perimeter to draw the lines that define the stretchable patches and (optional) content area.

• Left & top to define stretchable area!

• Bottom & right content area

Page 16: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

• Examples of android:scaleType attribute. Top row (l-r) center, centerCrop, centerInside. Bottom row (l-r): fitCenter, fitStart, fitEnd, fitXY.

Page 17: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Styles

• Inheritance

Page 18: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Attributes• You can define attributes in the top <resources> element or inside of a

<declare-styleable> element. Note, all attributes share the same global namespace.

Page 19: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Themes• Inheritance!

• Watch out for API level!

• Define themes in values, values-v11, values-v14!

• Check out Sherlock themes

Page 20: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Dimen• Dimen values are useful to define !

• Bool!

• Color!

• Dimension - dp/sp/pt/px/mm/in!

• ID!

• Integer!

• Integer Array!

• Typed Array

Page 21: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Project Resource Structure (I)• Drawable-hpdi…!

• Layout-hdpi…, !

• Layout-port and layout-land!

• Values-hdpi…!

• Concatenating configurations - layout-sw600dp-land!

• Layout-sw600dp - declaring tablet layouts in reference

Page 22: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Project Resource Structure (II)

Page 23: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Project Resource Structure (III)

Page 24: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Fonts• Static init in onCreate in Application class!

!

!

!

!

Page 25: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Custom components

Page 26: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Custom View

Page 27: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Custom Sexy Component

Page 28: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Canvas And Custom Components

Page 29: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Developer Options

Page 30: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Conclusion (I)• New rule: in exported screens 1px equals 1dp. Our designers

are designing for 160 dpi screens, which is the baseline for density for the Android OS!

• Use Preview to calculate distances between objects in the layout!

• Develop the app taking into consideration that a font could change!

• Use styles!

• Use attributes in order to be able to switch styles in themes and add custom data to your views

Page 31: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

Conclusion (II)

• Standardise frequently used component’s dimensions!

• Example: list items, dashboard items, specific screen dimensions like Settings screen, Drawer menu items etc.!

• Create custom styles and views for these components!

• Use wisely

Page 32: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

References (|)• http://android-holo-colors.com/!

• http://coh.io/adpi/!

• http://blog.edwinevans.me/?p=131!

• http://developer.android.com/training/basics/supporting-devices/screens.html!

• http://blog.edwinevans.me/?p=131!

• https://developer.android.com/training/displaying-bitmaps/manage-memory.html

Page 33: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

References (||)• Holo-colors plugin —> https://github.com/jeromevdl/android-holo-colors-

idea-plugin!

• http://android-holo-colors.com/!

• ImageView —> http://www.peachpit.com/articles/article.aspx?p=1846580&seqNum=2!

• http://developer.android.com/guide/practices/screens_support.html#DeclaringTabletLayouts!

• http://developer.android.com/design/patterns/settings.html!

• http://developer.android.com/guide/topics/resources/providing-resources.html

Page 34: Infinum Android Talks #03 - Android Design Best Practices - for Designers and Developers

?Marko Vitas, @vitongs