Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Design and development: Best practices by example

Design and development: Best practices by example

With a poor feedback loop between design and development, it's easy to fall into the trap of low quality code with a lack of cohesion in the UI.

droidcon London 2016
https://skillsmatter.com/skillscasts/8777-design-and-development-best-practices-by-example

Avatar for Matt Dolan

Matt Dolan

October 27, 2016
Tweet

More Decks by Matt Dolan

Other Decks in Programming

Transcript

  1. 100

  2. – Sun Microsystems, Inc “Hardly any software is maintained for

    its whole life by the original author.”
  3. An example colors.xml <?xml version="1.0" encoding="utf-8"?>
 <resources> 
 <color name=”grey_separator”>@color/cool_grey</color>

    <color name=”gray_list_divider”>#e3e3e0</color> <color name=”market_list_intermediate_gray”>@color/gray_list_divider</color> <color name=”button_grey_pressed”>#80555555</color> <color name=”background_grey”>#f5f5f5</color> <color name=”pale_grey”>#e2e4e1</color> <color name=”dark_grey”>#555555</color> <color name=”darker_grey”>#4f4f4f</color> <color name=”darker_than_light_grey”>#777777</color> <color name=”light_grey”>#b2b4b2</color> <color name=”light_dark_grey”>#ff666666</color> <color name=”pearl_grey”>#d9d8d9</color> <color name=”soft_grey”>#dfdfdf</color> <color name=”cool_grey”>#999999</color> <color name=”transparent_grey”>#cc000000</color> <color name=”transparent_black”>#c0000000</color> ...
  4. The beginning of some rules… 1. Keep names consistent 2.

    Avoid naming by colour 3. Function over context 4. Don’t inline colours
  5. The beginning of some rules… 1. Keep names consistent 2.

    Avoid naming by colour 3. Function over context 4. Don’t inline colours 5. Generic to specific
  6. A semantic colors.xml <?xml version="1.0" encoding="utf-8"?>
 <resources> 
 <color name=”text_primary”>#262629</color>

    <color name=”text_secondary”>#6C6C7A</color> <color name=”text_positive”>#3987CC</color> <color name=”text_negative”>#CC1818</color> <color name=”text_neutral”>#3BA43B</color> <color name=”marketStatus_open”>#3BA43B</color> <color name=”marketStatus_closed”>#CC1818</color> <color name=”marketStatus_onCall”>#F5AD1C</color> <color name=”marketStatus_editOnly”>#3987CC</color> <color name=”button_submit__background”>#3BA43B</color> <color name=”button_submit__foreground”>#FFF</color> <color name=”divider”>#E0E0E0</color> ...
  7. Name palette by colour Compare to a list – and

    look for similarity: • Named Web Colors — http://en.wikipedia.org/wiki/ Web_colors • Crayola — http://en.wikipedia.org/wiki/ List_of_Crayola_crayon_colors • Ingrid’s Color Thesaurus — http:// ingridsnotes.wordpress.com/2014/02/04/the- color-thesaurus/
  8. Name palette by colour Use a tool – these provide

    names based on hex values: • Name That Color — http://chir.ag/projects/name- that-color • Color Name & Hue — http://www.color- blindness.com/color-name-hue/
  9. Name palette by colour Make it up • Make it

    meaningful – can you figure out where it is on a colour wheel?
  10. A final colors.xml <?xml version="1.0" encoding="utf-8"?>
 <resources> 
 <color name=”text_primary”>@color/palette_charcoal</color>

    <color name=”text_secondary”>@color/palette_slate</color> <color name=”text_positive”>@color/palette_blue</color> <color name=”text_negative”>@color/palette_red</color> <color name=”text_neutral”>@color/palette_green</color> <color name=”marketStatus_open”>@color/palette_green</color> <color name=”marketStatus_closed”>@color/palette_red</color> <color name=”marketStatus_onCall”>@color/palette_yellow</color> <color name=”marketStatus_editOnly”>@color/palette_blue</color> <color name=”button_submit__background”>@color/palette_green</color> <color name=”button_submit__foreground”>@color/palette_white</color> <color name=”divider”>@color/palette_smoke</color> ...
  11. Palette colours 1. Name by colour 2. Prefix the palette

    Rules for colours Semantic colours 1. Keep names consistent 2. Avoid naming by colour 3. Function over context 4. Don’t inline colours 5. Generic to specific
  12. Styling with AppCompat activity_layout.xml ... <Button
 android:id="@+id/submit"
 android:text="Place deal"
 android:theme="@style/ButtonSecondary"/>

    styles.xml <style name=“ButtonSecondary" parent="ThemeOverlay.AppCompat.Light">
 <item name=“colorAccent">@color/button_secondary</item>
 </style>
  13. An example style <style name=”StopView”> 
 <item name=”android:layout_width”>0dp</color> <item name=”android:layout_weight”>1</color>

    <item name=”android:layout_height”>wrap_content</color> <item name=”android:textSize”>@dimen/stopview_text_size</color> <item name=”android:textColor”>@color/secondary_text</color> </style>
  14. 1. Avoid Custom Components (Use AppCompat) 2. Prefix theme styles

    3. Avoid layout_* attributes Rules for styles
  15. 1. Avoid Custom Components (Use AppCompat) 2. Prefix theme styles

    3. Avoid layout_* attributes 4. Keep names consistent 5. Function over context 6. Generic to specific Rules for styles
  16. Colour Palette CTA #9696A3 #E0E0E0 #EBEBEB #F5F5F5 #3987CC #CC1818 #3BA43B

    #2574B8 #6C6C7A #262629 #F5870A #64367A Chrome Core Text Misc. Primary Text Muted Text Action Colour TBC BUY Ac6on Colour Scndry CTA SELL IG Brand Dealing Primary CTA Lines/ Dividers/ Icons/ Chrome/ Tertiary CTAs
  17. Colour Palette #9696A3 Grey #E0E0E0 Smoke #EBEBEB Cloud #F5F5F5 Bone

    #3987CC IG Blue #CC1818 IG Red #3BA43B IG Green #6C6C7A Slate #262629 Charcoal #64367A IG Purple #F5AD1C IG Yellow #FFFFFF White #333987CC Blue_20pct #33CC1818 Red_20pct
  18. Typography Typography Font Colours H1 Header Regular 24sp Primary Charcoal

    Title Medium 20sp Secondary Slate Subheader Regular 16sp Interactive Blue Body 2 / Menu Medium 14sp Body 1 Regular 14sp Caption Regular 12sp BUTTON Medium 14sp