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
550
Play with Kotlin
Kotlinで遊ぶ
yoppie
March 25, 2019
Tweet
Share
More Decks by yoppie
See All by yoppie
AmperとFleetを使ったAndroidアプリ
yoppie
0
570
Androidエンジニアが Flutterでアプリを リリースするまでの苦悩
yoppie
0
480
Navigation Component 実践編
yoppie
1
210
FragmentContainerViewとは
yoppie
0
630
Recent tips collection
yoppie
0
850
Distribute Android app updates with bitrise
yoppie
0
1.3k
EC2 using Lumen and DynamoDB and SNS
yoppie
1
210
sabotage
yoppie
1
870
Other Decks in Technology
See All in Technology
SREの前に
nwiizo
11
2.5k
国土交通省 データコンペ参加者向け勉強会
takehikohashimoto
0
360
mikroBus HAT を用いた簡易ベアメタル開発
tarotene
0
250
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
28k
Shift-from-React-to-Vue
calm1205
4
1.7k
元旅行会社の情シス部員が教えるおすすめなre:Inventへの行き方 / What is the most efficient way to re:Invent
naospon
2
210
re:Invent 2024のおすすめセッション
beli68
0
110
State of Open Source Web Mapping Libraries
dayjournal
0
200
利きプロセススケジューラ
sat
PRO
4
2.6k
Engineering at LY Corporation
lycorp_recruit_jp
0
180
Windows Autopilot Deployment by OSD Guy
tamaiyutaro
0
290
AWS CodePipelineでコンテナアプリをデプロイした際に、古いイメージを自動で削除する
smt7174
1
130
Featured
See All Featured
Designing for Performance
lara
604
68k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Agile that works and the tools we love
rasmusluckow
327
21k
Designing the Hi-DPI Web
ddemaree
280
34k
Writing Fast Ruby
sferik
627
61k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
What's in a price? How to price your products and services
michaelherold
243
12k
It's Worth the Effort
3n
183
27k
The World Runs on Bad Software
bkeepers
PRO
65
11k
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Ͱ༡Ϳʂ