Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
tab for Androidの作り方
Search
lychee
April 24, 2014
Technology
400
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
tab for Androidの作り方
lychee
April 24, 2014
More Decks by lychee
See All by lychee
Android開発者とデザイナーの効果的な連携に効く話
superdry
0
79
はじめてのぐーぐるあいおー
superdry
0
170
Other Decks in Technology
See All in Technology
SREのためのFinOps入門
muziyoshiz
2
1k
GCASアップデート(202607-202610)
techniczna
1
250
Metadata - Section 3 : Dublin Core Standard · DC
mohab1
0
120
In-Context Learning再入門。ICLの勾配降下的解釈の研究動向を追ってみる。
dai08srhg
1
780
お客様の「やりたい」の先を見通す合意形成プロセス ~裏にある課題と不安を解きほぐすコツ~
yukakoseki
0
140
PostgreSQL オプティマイザ統計の秘密
nori_shinoda
1
450
The Author Pays
hiccupps
0
150
長い仕事を任せる (Workflows、クラウドセッション、Kiro Web) | 目指せ Kiro マスター 10
inariku
PRO
3
160
AWS基盤改善を支える 私たちの理念と行動指針
kentosuzuki
0
140
81天的 AI Agent 軟體開發團隊治理實務分享
regionbbs
0
150
現場を動かすAIエージェント#2_製造業現場でのAI活用から見た、ハマる罠と実践知
kintotechdev
2
210
新卒エンジニア、 介護士になる
ryu1013
1
700
Featured
See All Featured
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
Become a Pro
speakerdeck
PRO
31
6.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
What's in a price? How to price your products and services
michaelherold
247
13k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
800
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
970
Believing is Seeing
oripsolob
1
270
sira's awesome portfolio website redesign presentation
elsirapls
0
500
Transcript
tab for Androidͷ࡞Γํ Yasuyo Nishioka (tab Inc.) 2013/4/24
tab for Android • 2013/2 ։ൃ։࢝ • ݱࡏ1.9.3൛ • ։ൃମ੍2໊
• ϦϦʔε݄2ʙ4ϖʔε • ରԠൣғɿAPI Ϩϕϧ 10(2.3.3)Ҏ্ • ࡉʑͱͬͯ·͢ ΤϯδχΞืूதʂ
ࠓ͢͜ͱ • ։ൃπʔϧ • ΞϓϦͷߏͱ༻ϥ ΠϒϥϦ • API௨৴෦ • JSONύʔα
• Model • ը໘දࣔ • ͦͷଞϥΠϒϥϦ • ςετ
։ൃπʔϧ
։ൃπʔϧ • IDE • Eclipse • Android StudioʹҠ ߦத •
ϦϙδτϦ • GitHub Enterprise • CI • Jenkins @AWS • ࣾςετ • DeployGate
πʔϧͷ࿈ܞ ᶃpush ᶄpull ᶅbuild ᶆupload ᶇdownload ᶈdogfooding
ͦͷଞπʔϧ • A/Bςετ • Apptimize • Ҋ݅ཧ • Pivotal Tracker
• όάཧ • Bugsense • ίϛϡχέʔγϣϯ • Hipchat
Apptimize
Pivotal tracker
Bugsense
Hipchat Bugsense Pivotal Jenkins Github ͱ࿈ܞ
ΞϓϦͷߏͱ༻ϥΠϒϥϦ
"1*௨৴෦ • ϥΠϒϥϦ:Android Async Http Client • ࣌Volley͕ͳ͔ͬͨ • ը૾μϯϩʔυܥAPI͔ͭͬͯͳ͍
(ޙड़) • AsyncHttpResponseHandleΛ֦ு͠REST APIίʔϧ͔ΒJSONύʔεͯ͠ModelΦϒ δΣΫτͱͯ͠อ࣋͢Δ·ͰҰ؏ͰΕΔ Α͏ʹ͍ͯ͠Δɻ
ʢྫʣ"1*௨৴෦ public static void get(int id, final OnPostListener<ItemObject> listener) {
String pathString = String.format("items/%d.json", id); tabRestClient.execute( pathString, null, new TabApiResponseHandler<ItemObject>(listener)); }
ྫʣσʔλऔಘ Item.get(itemId, new OnPostListener<ItemObject>() { @Override public void onError(Throwable e,
Error error) { //Τϥʔॲཧ } @Override public void onCompletion(ItemObject response) { Item item = response.getItem(); // Α͠ͳʹ } });
Model • ϥΠϒϥϦ:Lombok • ίʔυྔݮ • BundleʹͭΊΕΔΑ͏ʹSerializableΛܧঝ • ઌ΄Ͳͷσʔλऔಘͷॲཧ͜ͷΫϥεʹ ࣮
ίʔυྔͷൺֱ import lombok.Data; @Data public class Item implements Serializable {
public static final String KEY = "item"; /** Response */ private int id; private String title; private String description; public static void get(int id, hogehoge...){ //͖ͬ͞ͷίʔυ } } public class Item implements Serializable { public static final String KEY = "item"; /** Response */ private int id = Models.INVALID_INT; private String title; private String description; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public static void get(int id, hogehoge...) { //͖ͬ͞ͷίʔυ } }
JSONύʔα • ϥΠϒϥϦ: Jackson • Jackson/GSON/JSONIC Ͱϕϯνͱ ͬͯൺֱ • ඇಉظॲཧ͢ΔΑ͏֦ு
ը໘දࣔ ྫ1) ͲΜͲΜͰͯ͘ΔΑ ϖʔδωʔγϣ ϯɾϓϦϩʔυ 2ྻදࣔ Pull to Refresh
Loader/Adapter • LoaderࣗಈͰϖʔδωʔγϣϯ͢ΔΑ͏֦ு • AdapterϓϦϩʔυΛ͢ΔΑ͏֦ு • GenericsͰڞ௨Խ
Loader/Adapter <<abstract>> BaseAdapter <<abstract>> AbstractLoaderAdapter CustomAdapter CustomPairLayout Adapter <<abstract>> AbstractDataLoader
<<interface>> DataLoader CustomLoader Activity, Fragment <<create>> <<create>> <<interface>> DataLoaderListener
ʢྫʣLoader public class ItemLoader extends AbstractDataLoader<Item> { @Override protected void
onLoadPage(int page, int limit, OnPostListener<? extends PaginatedResponse<Item>> listener) { Item.list(page, limit, (OnPostListener<PaginatedItems>) listener); } }
ʢྫʣAdapter public class ItemAdapter extends AbstractLoaderAdapter<ItemLoader> { public ItemAdapter(ItemLoader loader,
Context context) { super(loader, context); reload(); } @Override public View getView(int position, View convertView, ViewGroup parent) { // Α͠ͳʹ } }
Pull to refresh ListView • ༻ϥΠϒϥϦ: Pull to Refresh
ListView • ࣌ActionBar-PullToRefresh SwipeRefreshLayoutͳ͔ͬͨ • ܰྔ • GridView͕͑ͳ͍ • ͋·Γϝϯςφϯε͞Εͯͳ͍ͷͰɺҰ෦ SwipeRefreshLayoutʹҠߦத • ϑολʔʹϩʔσΟϯάΞχϝʔγϣϯΛදࣔ͢ ΔΑ͏֦ு
ը૾μϯϩʔυ • ༻ϥΠϒϥϦ: Universal Image Loader • ࠷ॳSmartImageViewΛ͍͕ͬͯͨɺͪ͜ Βͷํ͕ɺΦϓγϣϯ͕๛(σΟϨΠදࣔɺ ؙ֯ɺΩϟογϡͳͲ)ͰΧελϜ͍͢͠
• inMemory/onDiskͰΩϟογϡ • ؙ֯ॏ͍ͷͰ֎ͨ͠
ը໘දࣔ ྫ2) ·ͩ·ͩ͋ΔΑ ɹػೳ͕Γͩ͘͞Μ ฤूɺআɺίϐʔɺҠಈɺڞ༗ɺ tabாϑΥϩʔɺ༧ɺϦΫϦοϓɺಛయද ࣔɺใදࣔɺళฮใදࣔɺϚοϓɾϧʔ τݕࡧɺ ผΞΠςϜͷαδΣετɺϦΫϦοϓҰ ཡɺίϝϯτ…
• ॳ1Fragment͕ͩͬͨlistenerͩΒ͚ ʹͳͬͯ͠·͍ϝϯςφϯε͕ࠔʹ • Nested Fragmentʹ͏͜Γ͝Γ • Event busΛ͏͜ͱʹ
Event Bus • ༻ϥΠϒϥϦɿSquare Otto • Activity-Fragmentؒɺ֤Fragmentؒͷ௨ʹ༻ • Fragmentͷָׂ͕ʹˍListenerࠈ͔Βղ์ •
Weak Reference ͬͯunregister͠ͳ͍͍ͯ͘Α͏ʹ ֦ு
ͦͷଞ༻ϥΠϒϥϦ • Android-ViewPagerIndicator • Android-MenuDrawer • ArcMenu/SwitchCompatLibrary • Google Play
Service • GridLayout • Facebook SDK • Twitter4j • OrmLite ... ଟ͗ͯ͢ɺ ϝιου্ݶʹ Ҿ͔͔ͬΔ
ϝιου্ݶ • ݱ • ಛఆͷ2.3ܥͰىಈͰ͖ͳ͍ • Error while installing application
(INSTALL_FAILED_DEXOPT) • ݪҼ • ϝιου͕65536Ҏ্ʹͳΔͱDexoptͷ ͏όοϑΝαΠζΛ͑Δ
ରॲ • ϥΠϒϥϦΛεϦϜʹ • ͋·Γͬͯͳ͔ͬͨGuavaΛ֎͢ • GooglePlayServicesͱAnalyticsͷϥΠϒϥϦ Λซ༻͠ͳ͍ • ຊདྷ...
• ProGuardͰ࠷దԽ • dexϑΝΠϧΛׂ͠ΧελϜΫϥεϩʔσΟ ϯά • Facebookϒϩάͱ͔
ςετ
ςετ • ༻ϥΠϒϥϦɿMockito + Roboguice • ςετϙϦγʔ • ௨৴෦ɾModelɾLoaderςετඞਢ •
API௨৴෦Λmock/spyͯ͠ਖ਼ৗ/ҟৗܥ Ұ௨Γ
՝ • γφϦΦςετΛ͍ͨ͠ • RobotiumΛͬͯγφϦΦςετ࣮͠ ͕ͨɺ҆ఆ͠ͳ͍ҝ͍ͣͯ͠Δ • Espresso? • final/staticϝιουͰϞοΫͰ͖ͳ͍
• PowerMock?
͓͠·͍ ΤϯδχΞืूதʂ