Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Denver Droids: UI
Search
Dave Smith
April 20, 2011
Programming
2
100
Denver Droids: UI
My first ever Android presentation. Uploaded for posterity.
Dave Smith
April 20, 2011
Tweet
Share
More Decks by Dave Smith
See All by Dave Smith
Android Security Features
devunwired
4
700
ConstraintLayout, Inside and Out
devunwired
21
1.7k
Digging Into Android System Services
devunwired
8
1.5k
Flattening Layouts with Constraints
devunwired
3
290
Hello, Brillo: ELC Edition
devunwired
0
250
Mastering CoordinatorLayout Behaviors
devunwired
16
1.4k
Hello, Brillo
devunwired
1
2.1k
Google Proximity Beacons Overview
devunwired
4
230
Proximity Beacons and the Nearby API
devunwired
1
1.9k
Other Decks in Programming
See All in Programming
為你自己學 Python - 冷知識篇
eddie
1
330
MCPとデザインシステムに立脚したデザインと実装の融合
yukukotani
3
1.1k
2025 年のコーディングエージェントの現在地とエンジニアの仕事の変化について
azukiazusa1
15
6k
テストカバレッジ100%を10年続けて得られた学びと品質
mottyzzz
2
430
AIを活用し、今後に備えるための技術知識 / Basic Knowledge to Utilize AI
kishida
19
4.3k
詳解!defer panic recover のしくみ / Understanding defer, panic, and recover
convto
0
210
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
1
330
サーバーサイドのビルド時間87倍高速化
plaidtech
PRO
0
690
More Approvers for Greater OSS and Japan Community
tkikuc
1
110
時間軸から考えるTerraformを使う理由と留意点
fufuhu
9
3.8k
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
410
AI時代のUIはどこへ行く?
yusukebe
11
5.8k
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
The Invisible Side of Design
smashingmag
301
51k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
6.1k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
Docker and Python
trallard
45
3.5k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
A designer walks into a library…
pauljervisheath
207
24k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
Building Adaptive Systems
keathley
43
2.7k
Unsuck your backbone
ammeep
671
58k
Become a Pro
speakerdeck
PRO
29
5.5k
Transcript
Crea%ng(UI(the(Smart/Kid(Way( Dave(Smith( April(20,(2011( @devunwired(
Who(is(this(guy?( • Mobile(Developer((Android(&(iOS)( • Recovering(Spark(Chaser( – Embedded(Systems( – Hardware(Integrator( • Co/Author(of(Android(Recipes( – Shameless(Plug(&(Giveaway(
10,000(Foot(View( • UI(Libraries( • Using(Resources(to(make(DIY(Easier( – Screen(Support( – Rota%on( • Sample(Applica%on(
Google’s(UI(Design(PaWerns( • Dashboard( • Ac%on(Bar( • Quick(Ac%on( Images(Courtesy(of(androiduipaWerns.com(
Use(a(Library.((Move(on.( • DashboardLayout( – Roman(Nurik(@(Google( – Custom(Layout(for(Dashboard(Grids( – gist.github.com/882650( •
GreenDroid( – Requires(a(custom(Applica%on(class((Boo)( – Ac%onBar( – QuickAc%on( – AsyncImageView( – github.com/cyrilmoaer/GreenDroid( • Ac%onBarSherlock( – Drop/in(Widget( – Honeycomb(Compa%ble(Ac%onBar( – github.com/JakeWharton/Ac%onBarSherlock( • CommonsWare(Android(Components((CWAC)( – EndlessAdapter( – ColorMixer( – github.com/commonsguy(
GreenDroid(Sample(Demo( • Ac%onBar( – Ac%onBarItem( – LoaderAc%onBarItem( • QuickAc%on( • AsyncImageView(
How(Android(Classifies(Screens( • Size( – Small((<3")( – Normal((3"/5")( – Large((5"/7")( –
xLarge((7"/10";(Android(2.3)( • Density( – Low((ldpi)( • 75%(MDPI( – Medium((mdpi)( – High((hdpi)( • 150%(MDPI( – Xtra/High((xhdpi;(Android(2.2)( • 200%(MDPI( • Eek!((That's(16(Different(Configura%ons(to(support!(…Not(really(
Recipe(for(Phone(UI( • Scale(Images(for(all(Densi%es( • Build(Layouts(for(one(size( res/drawable( res/drawable/ldpi( res/drawable/mdpi( res/drawable/hdpi( res/layout(
res/layout/land( • Shut(out(tablets(by(adding(the(following(manifest(item:( <uses-feature !android:name="android.hardware.telephony"/>!
Recipe(for(Adding(Tablet(Support( • Double(your(MDPI(Assets(Resolu%ons( • Add(layouts(for(larger(screens( res/layout/large( res/layout/large/land( res/layout/xlarge( res/layout/xlarge/land( •
"3.0(only"(support(can(use(the(v11(qualifier(instead( res/layout/v11( res/layout/v11/land( • Shut(out(phones(by(adding(the(following(manifest(item:( <supports-screens! !!android:smallScreens="false"! !!android:normalScreens="false"/>!
Smart(Kids(Use(XML( • Use(XML(whenever(possible!( – Android(itself(has(more(lines(of(XML(than(any(other( language((Java,(C,(or(C++)…learn(from(that.( – XML(Resources(are(inherently(scalable( • Shapes(
• Gradients( • Selectors((Color,(Image)( • Place(all(XML(drawables(into(res/drawable( – Resolu%on(Independent( • 9/Patches(are(annoying,(try(to(avoid(them(
Suppor%ng(Rota%on( • Why(should(I?((It's(Hard!( – Tablets(are(na%ve(landscape( – Physical(keyboard(devices( • Plus…it's(not(that(hard.( • Ease(the(pain(by(handling( yourself(where(possible,(and(
locking(where(appropriate.(
The(Problem( • Tradi%onal(Rota%on(destroys(the(Ac%vity(and( then(recreates(it.( – This(requires(saving(of(UI(state( – It's(slow( – WTH(do(we(do(with(running(background( opera%ons?(
Easy(Road:(Lock(It!( • Some%mes,(locking(an(Ac%vity(is(appropriate( – Video(Player(or(Camera(Overlay(always(displaying( in(Landscape( • To(lock,(simply(add( android:screenOrientation="portrait"(or( android:screenOrientation="landscape"(to( the(<activity>(element(
– Locking(is(per(Ac%vity,(not(global(to(the( applica%on(
Smart/Kid(Road:(Handle(It(Yourself( • Tell(Android(to(no%fy(you(of(the(change,(and(you'll(take(care(of(the( upkeep( • Add(android:configChanges="keyboardHidden|orientation"(to( the(<activity>(element( • Implement(onConfigurationChanged()(in(the(Ac%vity(code.( •
Android(will(not(destroy(your(Ac%vity( • If(you(do(not(have(separate(resources((layouts,(etc.)(for(landscape( vs.(portrait…you're(done!( • If(you(DO(have(a(special("layout/land"(or(the(like,(a(quick(call(to( setContentView()(will(redraw(your(view(with(the(right(resources.( – You(will(also(have(to(reaWach(any(pointers(grabbed(through( findViewById()! • No(other(state(need(be(saved(or(restored.!
Fixing(a(Tradi%onal(Headache( • With(tradi%onal(rota%on,(persis%ng(objects(is( s%ll(a(mess.( • A(background(opera%ons((like(AsyncTask)(can't( be(stuffed(in(a(Bundle.( • onRetainNonConfigurationInstance()( – Pass(any(single(object(across(a(rota%on(life/cycle.(
• getLastNonConfigurationInstance()! – Retrieve(the(object(upon(re/crea%on.(
Let's(Play(With(Some(Code!(