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
620
ConstraintLayout, Inside and Out
devunwired
21
1.7k
Digging Into Android System Services
devunwired
8
1.4k
Flattening Layouts with Constraints
devunwired
3
260
Hello, Brillo: ELC Edition
devunwired
0
240
Mastering CoordinatorLayout Behaviors
devunwired
16
1.3k
Hello, Brillo
devunwired
1
2k
Google Proximity Beacons Overview
devunwired
4
230
Proximity Beacons and the Nearby API
devunwired
1
1.8k
Other Decks in Programming
See All in Programming
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
290
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
330
CSC509 Lecture 12
javiergs
PRO
0
160
Amazon Qを使ってIaCを触ろう!
maruto
0
400
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.5k
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
297
20k
4 Signs Your Business is Dying
shpigford
180
21k
Become a Pro
speakerdeck
PRO
25
5k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
GitHub's CSS Performance
jonrohan
1030
460k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
89
Making the Leap to Tech Lead
cromwellryan
133
8.9k
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!(