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
94
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
580
ConstraintLayout, Inside and Out
devunwired
21
1.6k
Digging Into Android System Services
devunwired
8
1.3k
Flattening Layouts with Constraints
devunwired
3
250
Hello, Brillo: ELC Edition
devunwired
0
230
Mastering CoordinatorLayout Behaviors
devunwired
16
1.3k
Hello, Brillo
devunwired
1
1.9k
Google Proximity Beacons Overview
devunwired
4
220
Proximity Beacons and the Nearby API
devunwired
1
1.8k
Other Decks in Programming
See All in Programming
Apache Hive 4 on Treasure Data
ryukobayashi
0
350
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
880
新宿ダンジョンを可視化してみた
satoshi7190
2
270
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
230
Code Reviews
bkuhlmann
4
890
使ってみよう Azure AI Document Intelligence
kosmosebi
2
330
Fragment Composition of GraphQL
quramy
7
1k
VSCodeでのDatabricks開発もお勧めしたい/I would also recommend Databricks development with VSCode.
kazumain
0
260
SIMD Parallel Programming with the Vector API
josepaumard
0
200
Scalable Customer Journey Orchestration (CJO)
lewuathe
0
350
PHPはいつから死んでいるかの調査
chiroruxx
1
400
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
110
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
322
20k
Web development in the modern age
philhawksworth
202
10k
Optimising Largest Contentful Paint
csswizardry
8
2.4k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
14
1.6k
Building an army of robots
kneath
300
41k
Why You Should Never Use an ORM
jnunemaker
PRO
51
8.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
16
2.6k
The Invisible Customer
myddelton
114
12k
Designing the Hi-DPI Web
ddemaree
276
33k
The MySQL Ecosystem @ GitHub 2015
samlambert
243
12k
Faster Mobile Websites
deanohume
299
30k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
501
140k
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!(