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
520
Play with Kotlin
Kotlinで遊ぶ
yoppie
March 25, 2019
Tweet
Share
More Decks by yoppie
See All by yoppie
AmperとFleetを使ったAndroidアプリ
yoppie
0
300
Androidエンジニアが Flutterでアプリを リリースするまでの苦悩
yoppie
0
460
Navigation Component 実践編
yoppie
1
180
FragmentContainerViewとは
yoppie
0
550
Recent tips collection
yoppie
0
740
Distribute Android app updates with bitrise
yoppie
0
1.2k
EC2 using Lumen and DynamoDB and SNS
yoppie
1
200
sabotage
yoppie
1
840
Other Decks in Technology
See All in Technology
5分で分かる(かもしれない) Vector engine for OpenSearch Serverless
tsukuboshi
1
430
能動学習のいろは:書籍「Human-in-the-Loop機械学習」3〜5章
hiroyoshiito
0
310
シンプルなHITL機械学習と様々なタスクにおけるHITL機械学習
naohachi89
0
340
Domain-driven Design: A Complete Example
ewolff
2
270
汎用ポリシー言語Rego + OPAと認可・検証事例の紹介 / Introduction Rego & OPA for authorization and validation
mizutani
1
190
Blazor WASM × Code-first gRPC で始める C# ⼤統⼀理論
sansantech
PRO
1
910
Security Hubのセキュリティスコアはどうやって計算されるか
toru_kubota
0
110
QAエンジニアが伝えたい品質保証の羅針盤 / Compass for Quality Assurance
mii3king
2
350
テストコードを書きながらCompose Multiplatformを乗りこなす
subroh0508
0
150
データ分析力を高めるSQL研修サービス『SQL Everyone』
hikarut
1
400
データ基盤を支える技術
chanyou0311
5
3k
ハードウェアを動かすTypeScriptの世界
9wick
3
1.2k
Featured
See All Featured
Unsuck your backbone
ammeep
664
57k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
15
1.6k
What the flash - Photography Introduction
edds
64
11k
Making the Leap to Tech Lead
cromwellryan
125
8.6k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
9
1.3k
Into the Great Unknown - MozCon
thekraken
15
1.1k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
Scaling GitHub
holman
457
140k
Designing Experiences People Love
moore
136
23k
Learning to Love Humans: Emotional Interface Design
aarron
268
39k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
117
18k
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Ͱ༡Ϳʂ