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
retty-tech-cafe-8
Search
Yuya Kaido
December 09, 2016
Programming
210
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
retty-tech-cafe-8
Yuya Kaido
December 09, 2016
More Decks by Yuya Kaido
See All by Yuya Kaido
droidkaigi-2019
yuyakaido
7
4.9k
matching-dev-meetup-1
yuyakaido
1
240
minami-aoyama-night-6
yuyakaido
1
1.3k
eureka-meetup-10
yuyakaido
0
850
droidkaigi-2018
yuyakaido
4
6.2k
navitime-eureka-1
yuyakaido
0
110
droidkaigi-2017
yuyakaido
11
8.4k
mti-eureka-tech-beer
yuyakaido
0
510
potatotips-33
yuyakaido
2
680
Other Decks in Programming
See All in Programming
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
250
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
210
DynamoDBの基礎を振り返りながらベクトル検索機能を理解する
musan
2
200
初めての模倣学習とVLA
natsutan
0
240
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
380
AWS Transform Customによる Spring Boot 2.xから4.xへのVerUp
satoshi256kbyte
2
100
MySQLとPostgreSQLって何が違うの?
akagami
0
140
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
500
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
150
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
210
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
610
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
210
Featured
See All Featured
Balancing Empowerment & Direction
lara
6
1.2k
Statistics for Hackers
jakevdp
799
230k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
480
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Making the Leap to Tech Lead
cromwellryan
135
10k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
450
Why Our Code Smells
bkeepers
PRO
340
58k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.1k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
Transcript
Kotlin × Data Binding Retty Tech Cafe #8 yuyakaido
ࣗݾհ • ւ౻༏ʢ͔͍Ͳ͏Ώ͏ʣ • גࣜձࣾΤϨΧ • 1ͷΠϯλʔϯΛܦͯɺ20154݄ʹ৽ଔೖࣾ yuyakaido yuyakaido
None
࣍ • Kotlin͔ΒBindingΫϥεͷࢀর • BindingΫϥε͕ࢀরͰ͖ͳ͍ • BindingAdapter • ΧελϜόΠϯσΟϯά͕ಈ͔ͳ͍
BindingΫϥε͕ࢀরͰ͖ͳ͍ • Kotlin͔ΒBindingΫϥεΛࢀর͢Δͱ • ίϯύΠϧॱɿKotlin → Java Unresolved reference:
databinding Unresolved reference: ItemArticleBinding Unresolved reference: ItemArticleBinding
ղܾࡦ • generateStubsΛ༗ޮʹ͢Δ • kotlin-kaptΛ͏
generateStubsΛ༗ޮʹ͢Δ • Kotlin → Java • Stub → Kotlin →
Java kapt { generateStubs = true }
kotlin-kaptΛ͏ • KotlinʹΑΔAnnotation Processing࣮ • apply plugin: ‘kotlin-kapt' • ؆୯ͳαϯϓϧಈ࡞͠·ͨ͠
The new annotation processing still has known issues and may not be compatible with all annotation processors. You should enable it only if you’ve run into problems with the default kapt annotation processing implementation.
ΧελϜόΠϯσΟϯά͕ಈ͔ͳ͍ • GlidePicassoΛͬͯImageViewʹURLΛό Πϯυ͢Δ public class CustomBinder { @BindingAdapter("app:imageUrl")
public static void imageUrl(ImageView imageView, String url) { Glide.with(imageView.getContext()).load(url).into(imageView); } } class CustomBinder { companion object { @BindingAdapter("app:imageUrl") fun imageUrl(imageView: ImageView, url: String) { Glide.with(imageView.context).load(url).into(imageView) } } }
ղܾࡦ • JvmStaticΞϊςʔγϣϯΛ༩͢Δ • ֦ுؔͱ࣮ͯ͢͠Δ
JvmStaticΞϊςʔγϣϯΛ༩͢Δ class CustomBinder { companion object { @JvmStatic @BindingAdapter("app:imageUrl")
fun imageUrl(imageView: ImageView, url: String) { Glide.with(imageView.context).load(url).into(imageView) } } } object CustomBinder { @JvmStatic @BindingAdapter("app:imageUrl") fun imageUrl(imageView: ImageView, url: String?) { Glide.with(imageView.context).load(url).into(imageView) } }
֦ுؔͱ࣮ͯ͢͠Δ @BindingAdapter("android:imageUrl") fun ImageView.imageUrl(url: String?) { Glide.with(context).load(url).into(this) }
·ͱΊ • BindingΫϥε͕Kotlin͔ΒࢀরͰ͖ͳ͍ • generateStubsΛ༗ޮʹ͢Δ • kotlin-kaptΛ͏ • ΧελϜόΠϯσΟϯά͕ಈ͔ͳ͍ •
JvmStaticΞϊςʔγϣϯΛ༩͢Δ • ֦ுؔͱ࣮ͯ͢͠Δ
ࢿྉɾαϯϓϧίʔυ • Kotlin×Data Bindingͷͱղܾ๏ • http://qiita.com/yuyakaido/items/ e5acf5f8ac31c4ed8c77 • https://github.com/yuyakaido/Flow-Android
Thank you :) Credit: NASA Earth Observatory/NOAA NGDC