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
Play with Kotlin
Search
yoppie
March 25, 2019
Technology
1
550
Play with Kotlin
Kotlinで遊ぶ
yoppie
March 25, 2019
Tweet
Share
More Decks by yoppie
See All by yoppie
AmperとFleetを使ったAndroidアプリ
yoppie
0
580
Androidエンジニアが Flutterでアプリを リリースするまでの苦悩
yoppie
0
480
Navigation Component 実践編
yoppie
1
210
FragmentContainerViewとは
yoppie
0
630
Recent tips collection
yoppie
0
850
Distribute Android app updates with bitrise
yoppie
0
1.3k
EC2 using Lumen and DynamoDB and SNS
yoppie
1
210
sabotage
yoppie
1
880
Other Decks in Technology
See All in Technology
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
130
Platform Engineering for Software Developers and Architects
syntasso
1
520
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
710
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.7k
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
130
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
880
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
3
640
Engineer Career Talk
lycorp_recruit_jp
0
190
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
2
480
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
4
240
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
170
安心してください、日本語使えますよ―Ubuntu日本語Remix提供休止に寄せて― 2024-11-17
nobutomurata
1
1k
Featured
See All Featured
The Language of Interfaces
destraynor
154
24k
GraphQLとの向き合い方2022年版
quramy
43
13k
Scaling GitHub
holman
458
140k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Facilitating Awesome Meetings
lara
50
6.1k
How GitHub (no longer) Works
holman
310
140k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Transcript
KotlinͰ༡Ϳ
Facebook hi.kowaii.de / Twitter @yoppie_x Github yoshiya12X / Qiita yoppie_x
ϒϩά https://yoppiex.hatenablog.com/ yoppie
Kotlinͱͷग़ձ͍ ιϑτΣΞֶͷݚڀ AndroidΞϓϦͷιʔείʔυΛରͱ͍ͯͨ͠ ࣗͰͪΐͪ͜ΐ͜AndroidΞϓϦΛ࡞ͬͯͨ ֶ෦ େֶӃ
Kotlinͱͷग़ձ͍ KotlinΛॻ͖࢝ΊΔ (໊લ͕͔Θ͍͔ͬͨͷͰw) 20171݄
Kotlinͱͷग़ձ͍ ্ژ͠৽ଔͰαʔόʔαΠυΤϯδχΞʹͳΔ KotlinҾ͖ଓ͖झຯͰॻ͘ 20174݄
Kotlinͱͷग़ձ͍ GoogleIO Kotlin͕AndroidΞϓϦ։ൃͷओཁݴޠͱͳΔ 20175݄
Δ͔͠ͳ͍ ͜ͷϏοάΣʔϒʹ
ͪΌΜͱKotlinΛॻ͜͏ (ͱ͍͏͔༡΅͏)
KotlinͰ༡Ϳ(part1) μʔπϘʔυͱ࿈ܞͨ͠ DartsXͱ͍͏ΞϓϦΛͭͬͯ͘༡Ϳ 20176݄~10݄
None
None
KotlinͰ༡Ϳ(part1) ͪΐͪ͜ΐ͜Kotlin͞ΘΔ 201710݄~20184݄
KotlinͰ༡Ϳ(part2) GoogleIO ͜ͷ࣌ظʹͳΔͱ Android or KotlinͷษڧձΜʹͳΔ (ؾ͕͢Δ) 20185݄
ͬͱਂ͘۷ΓԼ͛Δ ༡ͼ͔ͨΛ͠Α͏
Kotlinͱ༡Ϳ(part2) ֤ࣾͷΤϯδχΞϒϩάΛ εϚχϡʔͬΆ͘ݟΒΕΔ EngineerBlogsΛ࡞(ਐߦத) 20186݄~ݱࡏ
DataBindingͱPicasso
͜Μͳ͜ͱ͋Γ·ͤΜ͔ DataBindingΛར༻͍ͯ͠ΔAndroidΞϓϦͰɺ PicassoGlideͰImageViewʹ ը૾Λද͍ࣔͤͨ͞
͜Μͳ͜ͱ͋Γ·ͤΜ͔ DataBindingΛར༻͍ͯ͠ΔAndroidΞϓϦͰɺ PicassoGlideͰImageViewʹ ը૾Λද͍ࣔͤͨ͞ BindingAdapter
XMLͷ αϯϓϧ
XMLͷ αϯϓϧ
Custom Binding KotlinͬΆ͘ImageViewͷ֦ுؔΛͬͯΈͨ
https://qiita.com/yoppie_x/items/ afcf582c083918c2c719
KotlinͱGson
KotlinͱGson૬ੑ͕ѱ͍ non-nullͳϓϩύςΟʹnull͕ ೖͬͯ͠·͏Մೳੑ
KotlinͱGson૬ੑ͕ѱ͍ Kotlinͷੑ্࣭id, name, imgnon-null img͕ͳ͍jsonΛparse͢Δ ྫ֎͕throw͞Εͣɺimgʹnull͕ೖΔ
MoshiΛ͏ Kotlin extension KotlinͷclassͷύʔεΛαϙʔτ nullͷ߹parse࣌ʹྫ֎͕throw͞ΕΔ build.gradle
Retrofit2ͱMoshiͷ࣮ྫ
https://qiita.com/yoppie_x/items/ bbc0ca7a4c8a4b29e141
KotlinͱRxBinding2
RxBinding2 • Jake Wharton࡞ • ViewͰͷΠϕϯτʹର༷ͯ͠ʑͳ݅ͳͲΛ ༩͠subscribe͢Δ͜ͱͰViewͰͷΞΫγϣ ϯΛ੍ޚ • Kotlin༷ʹ֦ு͞Ε͍ͯΔϥΠϒϥϦΛར༻
RxBinding2 • rxbinding-kotlin • rxbinding-recyclerview-v7-kotlin • rxbinding-appcompat-v7-kotlin • rxbinding-support-v4-kotlin •
rxbinding-design-kotlin • rxbinding-leanback-v17-kotlin
ಋೖ build.gradle
ಋೖ build.gradle -kotlin͕ඞཁ
rxbinding-kotlin OnClickListenerΑΓγϯϓϧ
rxbinding-recyclerview-v7-kotlin RecyclerViewͰεΫϩʔϧ͕Ұ൪Լ·Ͱ͍ͬͨΒ ϩʔυ͢Δ࣮
rxbinding-support-v4-kotlin Support-v4 LibraryͰಋೖͰ͖ΔViewʹର͢Δ ΞΫγϣϯΛ੍ޚ (ྫ)SwipeRefreshLayout
KotlinͰRxBinding2Λ ͬͯΈͨײ • ใ͕গͳ͍ͷ͕͖͍ͭ • ϝιουνΣʔϯͰ͔͚Δͷ͕͍͍ • Viewͷϓϩηεͷάϧʔϐϯά • Kotlinͷ֦ுؔ,
ଞͷRxܥͷϥΠϒϥϦͱ Έ߹ΘͤΔ͜ͱͰγϯϓϧʹͳΓͦ͏
https://qiita.com/yoppie_x/items/ c04974a346f7f5d4b413
݁
KotlinΧϫΠΠ
ΧϫΠΠਖ਼ٛ
Kotlinਖ਼ٛ
͜Ε͔Β KotlinͰ༡Ϳʂ