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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
210
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
570
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
1.1k
Foundation Models frameworkで画像分析
ryodeveloper
1
510
使いながら育てる Claude Code — 開発フローの1コマンド化 × 繰り返し指摘の自動仕組み化
shiki_kakaku
0
1.6k
React本体のコードリーディング
high_g_engineer
1
130
信頼性について考えてみる(SRE NEXT 2026 miniLT)
hayama17
0
240
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
290
PHPだって関数型したい 〜できること、できないこと〜 / fp-in-php
jsoizo
1
270
Claude Team Plan導入・ガイド
tk3fftk
0
250
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
440
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
0
120
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
How to Talk to Developers About Accessibility
jct
2
480
Thoughts on Productivity
jonyablonski
76
5.3k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
3
400
How GitHub (no longer) Works
holman
316
150k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Faster Mobile Websites
deanohume
310
32k
How to make the Groovebox
asonas
2
2.3k
Unsuck your backbone
ammeep
672
58k
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