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
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Quine, Polyglot, 良いコード
qnighy
4
650
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
Contemporary Test Cases
maaretp
0
140
距離関数を極める! / SESSIONS 2024
gam0022
0
290
初めてDefinitelyTypedにPRを出した話
syumai
0
420
Macとオーディオ再生 2024/11/02
yusukeito
0
370
as(型アサーション)を書く前にできること
marokanatani
10
2.7k
Outline View in SwiftUI
1024jp
1
330
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Building an army of robots
kneath
302
43k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Bash Introduction
62gerente
608
210k
Done Done
chrislema
181
16k
Thoughts on Productivity
jonyablonski
67
4.3k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Designing for humans not robots
tammielis
250
25k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Building Your Own Lightsaber
phodgson
103
6.1k
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!