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
680
ConstraintLayout, Inside and Out
devunwired
21
1.7k
Digging Into Android System Services
devunwired
8
1.5k
Flattening Layouts with Constraints
devunwired
3
280
Hello, Brillo: ELC Edition
devunwired
0
250
Mastering CoordinatorLayout Behaviors
devunwired
16
1.4k
Hello, Brillo
devunwired
1
2k
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
Webからモバイルへ Vue.js × Capacitor 活用事例
naokihaba
0
740
LINEヤフー データグループ紹介
lycorp_recruit_jp
0
760
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
200
アンドパッドの Go 勉強会「 gopher 会」とその内容の紹介
andpad
0
250
複数アプリケーションを育てていくための共通化戦略
irof
10
4k
Gleamという選択肢
comamoca
6
740
都市をデータで見るってこういうこと PLATEAU属性情報入門
nokonoko1203
1
550
地方に住むエンジニアの残酷な現実とキャリア論
ichimichi
2
630
Enterprise Web App. Development (2): Version Control Tool Training Ver. 5.1
knakagawa
1
120
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
1
160
すべてのコンテキストを、 ユーザー価値に変える
applism118
2
450
なぜ適用するか、移行して理解するClean Architecture 〜構造を超えて設計を継承する〜 / Why Apply, Migrate and Understand Clean Architecture - Inherit Design Beyond Structure
seike460
PRO
1
280
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Writing Fast Ruby
sferik
628
61k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
16
940
How to Think Like a Performance Engineer
csswizardry
24
1.7k
Six Lessons from altMBA
skipperchong
28
3.8k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
228
22k
What's in a price? How to price your products and services
michaelherold
245
12k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.8k
Facilitating Awesome Meetings
lara
54
6.4k
The World Runs on Bad Software
bkeepers
PRO
69
11k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
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!(