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
600
Play with Kotlin
Kotlinで遊ぶ
yoppie
March 25, 2019
Tweet
Share
More Decks by yoppie
See All by yoppie
AmperとFleetを使ったAndroidアプリ
yoppie
0
850
Androidエンジニアが Flutterでアプリを リリースするまでの苦悩
yoppie
0
530
Navigation Component 実践編
yoppie
1
260
FragmentContainerViewとは
yoppie
0
730
Recent tips collection
yoppie
0
980
Distribute Android app updates with bitrise
yoppie
0
1.4k
EC2 using Lumen and DynamoDB and SNS
yoppie
1
260
sabotage
yoppie
1
940
Other Decks in Technology
See All in Technology
[CVPR2025論文読み会] Linguistics-aware Masked Image Modelingfor Self-supervised Scene Text Recognition
s_aiueo32
0
210
退屈なことはDevinにやらせよう〜〜Devin APIを使ったVisual Regression Testの自動追加〜
kawamataryo
1
130
Yahoo!広告ビジネス基盤におけるバックエンド開発
lycorptech_jp
PRO
1
270
マイクロモビリティシェアサービスを支える プラットフォームアーキテクチャ
grimoh
1
200
制約理論(ToC)入門
recruitengineers
PRO
2
250
ABEMAにおける 生成AI活用の現在地 / The Current Status of Generative AI at ABEMA
dekatotoro
0
650
会社にデータエンジニアがいることでできるようになること
10xinc
9
1.6k
Postman MCP 関連機能アップデート / Postman MCP feature updates
yokawasa
0
140
サービスロボット最前線:ugoが挑むPhysical AI活用
kmatsuiugo
0
190
LLMエージェント時代に適応した開発フロー
hiragram
1
410
実践アプリケーション設計 ③ドメイン駆動設計
recruitengineers
PRO
1
150
AIドリブンのソフトウェア開発 - うまいやり方とまずいやり方
okdt
PRO
9
570
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
RailsConf 2023
tenderlove
30
1.2k
Designing for humans not robots
tammielis
253
25k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Embracing the Ebb and Flow
colly
87
4.8k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Documentation Writing (for coders)
carmenintech
73
5k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
570
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
820
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
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Ͱ༡Ϳʂ