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
Epoxyを用いたレイアウト構築術
Search
kobayashi_kento
August 27, 2019
Programming
1
210
Epoxyを用いたレイアウト構築術
8/27(火)に開催された pixiv App Night(ゲスト: Bitrise) での発表資料です
kobayashi_kento
August 27, 2019
Tweet
Share
More Decks by kobayashi_kento
See All by kobayashi_kento
Kotlinの好きなところ
kobaken0029
0
410
Compose駆動開発のためのマルチモジュール化
kobaken0029
0
170
DataStoreを導入してみた
kobaken0029
1
270
Androidエンジニアが1週間でiOSアプリ開発を学び、1ヶ月で大規模アプリ開発にJOINした話
kobaken0029
0
3k
Modern REST Communicate for Android
kobaken0029
0
1.5k
AndroidでモダンREST通信してみたった
kobaken0029
0
250
Other Decks in Programming
See All in Programming
cmp.Or に感動した
otakakot
2
150
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
120
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
900
イベント駆動で成長して委員会
happymana
1
320
Jakarta EE meets AI
ivargrimstad
0
540
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
役立つログに取り組もう
irof
28
9.6k
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Amazon Qを使ってIaCを触ろう!
maruto
0
400
Featured
See All Featured
Facilitating Awesome Meetings
lara
50
6.1k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Designing for humans not robots
tammielis
250
25k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Adopting Sorbet at Scale
ufuk
73
9.1k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Code Review Best Practice
trishagee
64
17k
Transcript
EpoxyΛ༻͍ͨϨΠΞτߏஙज़ pixiv.inc kobaken
kobaken ϐΫγϒגࣜձࣾ AndroidΞϓϦΤϯδχΞ Kotlin / Swift / Ruby
༏ / εϚϒϥ / ϙέΧ Twitter: @koba_dog_ GitHub: @kobaken0029
ɾEpoxyͬͯԿʁ ɾྨࣅϥΠϒϥϦʁ ɾEpoxyΛ͏ͱͲ͏ศརʹͳΔʁ ɾpixiv Sketch AndroidͰͷ׆༻ࣄྫ Index
EpoxyͬͯԿʁ
EpoxyͬͯԿʁ RecyclerView(ϦετάϦουදࣔʹ͏)ʹΑΔෳࡶͳϨΠΞτΛએݴతʹ ߏஙग़དྷΔAndroidϥΠϒϥϦɻAirbnbɻ https://github.com/airbnb/epoxy
ྨࣅϥΠϒϥϦʁ
ྨࣅϥΠϒϥϦʁ RecyclerViewΛ͍͍ײ͡ʹ͢Δܥ ɾGroupie એݴతʹUIΛΈཱͯΒΕΔܥ ɾKotlin/anko ɾJetpack Compose ɾsquare/contour←NEW!
એݴతʹUIΛΈཱͯΒΕΔܥ ɾSwiftUI
Ͱɺ࣮ࡍͲ͏ศརʹͳΔͷʁʁʁ
EpoxyΛ͏ͱͲ͏ศརʹͳΔʁ ɾAdapterΛॻ͔ͳ͍͍ͯ͘ʂˡ͜Ε͖͢ ɾࠩཧΛࣗಈͰͬͯ͘ΕΔʂˡ͜Ε͖͢ ɾData Binding ʹରԠ ɾศརͳΞυΦϯ͕ͨ͘͞Μʂ
EpoxyΛ͏ͱͲ͏ศརʹͳΔʁ ɾAdapterΛॻ͔ͳ͍͍ͯ͘ʂˡ͜Ε͖͢ ɾࠩཧΛࣗಈͰͬͯ͘ΕΔʂˡ͜Ε͖͢ ɾData Binding ʹରԠ ɾศརͳΞυΦϯ͕ͨ͘͞Μʂ
Adapter
%BUB4PVSDF -JTU "EBQUFS -JTU7JFX
σʔλ͕ViewʹΘΔ Α͏ʹ͍͍ײ͡ʹม ͯ͘͠ΕΔౕ
Ϧετදࣔ͢ΔͨΊͷ࠷খίʔυ
Ϧετදࣔ͢ΔͨΊͷ࠷খίʔυ
CustomAdapterͷ࣮
RecyclerView.Adapter with ViewTypeͷ࣮
&QPYZ͍ͬͯ͏ͷ͕͋ΔΑʂ ͔ΜͨΜͩΑʂ ΈΜͳͬͯΔΑʂ
Epoxyͩͱ͜͏
EpoxyΛ͏ͱͲ͏ศརʹͳΔʁ ɾAdapterΛॻ͔ͳ͍͍ͯ͘ʂˡ͜Ε͖͢ ɾࠩཧΛࣗಈͰͬͯ͘ΕΔʂˡ͜Ε͖͢ ɾData Binding ʹରԠ ɾศརͳΞυΦϯ͕ͨ͘͞Μʂ
EpoxyΛ͏ͱͲ͏ศརʹͳΔʁ ɾAdapterΛॻ͔ͳ͍͍ͯ͘ʂˡ͜Ε͖͢ ɾࠩཧΛࣗಈͰͬͯ͘ΕΔʂˡ͜Ε͖͢ ɾData Binding ʹରԠ ɾศརͳΞυΦϯ͕ͨ͘͞Μʂ
ࠩཧ ɾEpoxyController͕ࣗಈͰࠩΛऔͬͯ͘ΕΔ ɾͦ͜Ͱੜ͢ΔEpoxyModelͷequalshashCodeΛࢀর͍ͯ͠Δ ɾࠩߋ৽ΞϧΰϦζϜʹDiffUtilΛ࠾༻ ɾhttps://github.com/airbnb/epoxy/wiki/Diffing
EpoxyΛ͏ͱͲ͏ศརʹͳΔʁ ɾAdapterΛॻ͔ͳ͍͍ͯ͘ʂˡ͜Ε͖͢ ɾࠩཧΛࣗಈͰͬͯ͘ΕΔʂˡ͜Ε͖͢ ɾData Binding ʹରԠ ɾศརͳΞυΦϯ͕ͨ͘͞Μʂ
EpoxyΛ͏ͱͲ͏ศརʹͳΔʁ ɾAdapterΛॻ͔ͳ͍͍ͯ͘ʂˡ͜Ε͖͢ ɾࠩཧΛࣗಈͰͬͯ͘ΕΔʂˡ͜Ε͖͢ ɾData Binding ʹରԠ ɾศརͳΞυΦϯ͕ͨ͘͞Μʂ
EpoxyModelͱ EpoxyEpoxyModelΛհͯ͠ViewʹDataΛόΠϯυ͍ͯ͠Δ EpoxyModelࣗಈੜ͞ΕΔ EpoxyModelΛੜ͢Δํ๏3ͭ ɾCustomViewʹରͯ͠ΞϊςʔγϣϯΛ༩͢Δ ɾEpoxyModelWithHolderΛܧঝͯ͠ΞϊςʔγϣϯΛ༩͢Δ ɾpackage-info.javaΛهड़ͯ͠xmlΛData BindingରԠ͢Δ
Data BindingʹରԠ ɾ֤ηϧʹؔͯ͠େମͷ߹ɺxmlͷΈͰ݁Ͱ͖Δ ɾCustomViewΛ࡞Βͳͯ͘ྑ͍ ɾࠐΈೖͬͨॲཧBindingAdapterͰΓग़͢
EpoxyΛ͏ͱͲ͏ศརʹͳΔʁ ɾAdapterΛॻ͔ͳ͍͍ͯ͘ʂˡ͜Ε͖͢ ɾࠩཧΛࣗಈͰͬͯ͘ΕΔʂˡ͜Ε͖͢ ɾData Binding ʹରԠ ɾศརͳΞυΦϯ͕ͨ͘͞Μʂ
ศརͳΞυΦϯ ɾը૾ͷPreLoading on ɾศརʹΧελϚΠζ͞ΕͨRecyclerViewΛఏڙ ɾΧϧʔηϧ࣮ ɾεϫΠϓυϥοά&υϩοϓ
pixiv Sketch AndroidͰͷ׆༻ࣄྫ
௨ը໘
௨ը໘ ɾpackage-info.java ɾlayout xml ɾdata class ɾController ɾActivity/Fragment
package-info.java
Layout xml
Layout xml
Data class
Controller (ఆٛ)
Controller (Listener)
Controller
Activity / Fragment
ଞʹ…
ɾEpoxyෳࡶͳϦετ/ίϨΫγϣϯUIΛએݴతʹ࣮ग़དྷΔ ɾ֤row/cellͷ࣮ʹूதͰ͖Δ ɾEpoxyModelͷࠩΛݟͯɺࣗಈͰࠩߋ৽ͯ͘͠ΕΔ ɾ๛ͳΞυΦϯ͕ศར ɾEpoxy͍͍ͧ ·ͱΊ
Let’s Epoxy!