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.3k
mti-eureka-tech-beer
yuyakaido
0
510
potatotips-33
yuyakaido
2
680
Other Decks in Programming
See All in Programming
Claude Team Plan導入・ガイド
tk3fftk
0
240
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
270
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
120
AIエージェントで 変わるAndroid開発環境
takahirom
2
740
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
110
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
0
120
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
490
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
140
React本体のコードリーディング
high_g_engineer
0
110
Lean は証明の正しさを確認するためだけのツールって思ってませんか?
inoueasei
1
120
Android CLI
fornewid
0
190
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
0
170
Featured
See All Featured
Building AI with AI
inesmontani
PRO
1
1.1k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.6k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Building Applications with DynamoDB
mza
96
7.1k
Designing for Timeless Needs
cassininazir
1
420
Paper Plane (Part 1)
katiecoart
PRO
1
9.9k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
230
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
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